Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site decvax.UUCP Path: utzoo!watmath!clyde!burl!mgnetp!ihnp4!houxm!houxz!vax135!floyd!harpo!decvax!minow From: minow@decvax.UUCP (Martin Minow) Newsgroups: net.lang.c Subject: Re: C compiler for pdp-11 under RSX Message-ID: <11@decvax.UUCP> Date: Tue, 12-Jun-84 22:37:12 EDT Article-I.D.: decvax.11 Posted: Tue Jun 12 22:37:12 1984 Date-Received: Wed, 13-Jun-84 23:53:25 EDT References: <7447@umcp-cs.UUCP> Organization: DEC UNIX Engineering Group Lines: 47 Chris Torek (umcp-cs!chris) asks: "Is the following legal: extern int foo; ... int foo; or vice-versa." Yes (both ways) in Decus C, which emits global references when the file has been fully compiled. I think this fails on Whitesmith's compilers (though I haven't checked). However, the following should always work: extern int foo; ... int foo = 0; /* Explicit initialization */ Here is a more difficult problem: func() { extern char *localfunc(); ... } static char * localfunc() { ... } The above will not work correctly per the draft Ansi standard as the "globalness" of localfunc() was set by the *first* reference. Thus, localfunc() is global to all functions. The draft (and many existing compilers) permit you to write: func() { static char *localfunc(); ... I believe that this is an error (i.e. that the local/global distinction should be made by the defining instance), but the standards committee seems to want to make things easier for the people who want to write one-pass compilers. Martin Minow decvax!minow