Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site psivax.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxn!ihnp4!qantel!hplabs!sdcrdcf!psivax!friesen From: friesen@psivax.UUCP (Stanley Friesen) Newsgroups: net.lang.c Subject: Re: Forward Referencing of Static Variables OK? Message-ID: <773@psivax.UUCP> Date: Fri, 4-Oct-85 12:23:21 EDT Article-I.D.: psivax.773 Posted: Fri Oct 4 12:23:21 1985 Date-Received: Mon, 7-Oct-85 04:20:31 EDT References: <365@tekcbi.UUCP> Reply-To: friesen@psivax.UUCP (Stanley Friesen) Organization: Pacesetter Systems Inc., Sylmar, CA Lines: 29 Summary: In article <365@tekcbi.UUCP> jimpr@tekcbi.UUCP writes: >A C compiler we are using was designed in such a way that the following >code would not compile: > > extern int thing; /* don't know yet if thing is static or not */ . . . > static int thing = 0; /* now we know that it's static */ > >Their contention that not allowing this type of forward referencing of >static variables is consistent with "The C Programming Language", (K. & P.). > (Various other compilers are mentioned) >They all make "thing" static (ie, local to the file "thing" is defined in). > >What say you all? Is there any language in K & P which would dissuade them? >Thanks! > Well, I cannot find anything explicit in K&R, but the ANSI Draft Standard fairly clearly indicates that this *is*(or will be) legal. So any compiler which wants to conform th the std will have to accept this construct. -- Sarima (Stanley Friesen) UUCP: {ttidca|ihnp4|sdcrdcf|quad1|nrcvax|bellcore|logico}!psivax!friesen ARPA: ttidca!psivax!friesen@rand-unix.arpa