Forward Referencing of Static Variables OK?
Michael Meissner
meissner at rtp47.UUCP
Sun Oct 6 00:48:10 AEST 1985
In article <1893 at brl-tgr.ARPA> gwyn at BRL.ARPA (VLD/VMB) writes:
>extern int thing;
>...
>static int thing = 0;
>
>is perfectly legitimate according to X3J11.
>Why waste time trying to relate this to K&R (not K&P).
>Point out to your compiler supplier that they're
>going to have to fix this anyway.
>
Sorry that is wrong. The only thing that ANSI X3J11 allows is:
static int thing = 0;
foo(){
float thing;
/*...*/
{
extern int thing; /* refers to static above */
}
}
Ie, the first declaration MUST be static.
Michael Meissner, Data General, ...{ihnp4, decvax}!mcnc!rti-sel!rtp47!meissner
More information about the Comp.lang.c
mailing list