storage class ambiguity

John Nelson john at genrad.UUCP
Thu Nov 3 00:57:45 AEST 1983


There's no ambiguity here, any compiler that acts that way is WRONG!!!!
		
		file 1: extern int foo;
		file 2: extern int foo;

This should not generate a loader error, The loader is SUPPOSED to
allocate storage for foo.  Unfortunately, sometimes C running under operating
systems other than UNIX use the existing loader, which does not perform
this function.

		file 1: extern int foo = 8;

If the compiler generates an error on this, then it is just plain WRONG!
I cannot emphasize this enough.  The problem is not that the reference
manual should not say that extern is the default storage class, it IS,
and any compiler that does not work this way is not strictly C!


I had a similar problem with the Whitesmith compiler - all externs had to
be initialized (which could be lived with) but also, static's had to be
initialized!  If you have:

		file 1: static int foo;

you get the compiler message: "undeclared static foo".  We don't use
Whitesmiths anymore for this and numerous other non-standard items.



More information about the Comp.lang.c mailing list