storage class != Storage Class (Was: Why are typedef names ...)

Henry Spencer henry at utzoo.UUCP
Wed Dec 17 06:53:09 AEST 1986


> ...  How do you declare an object which
> is not being defined at this point and is not available externally?  Is there
> a portable way to make a forward declaration of a static variable?  (I've been
> using "extern", but I wonder if that really works on all compilers.)

Alas, it's not X3J11-compliant.  The current X3J11 drafts (well, the most
current that I've seen -- I haven't got the official public-comment one
yet) say that the first appearance of the name makes the rule, so you must
say "static" on its first appearance.  Unfortunately, a lot of existing
compilers don't like this.  (For that matter, *I* don't like it, but I am
not optimistic about getting it changed.)  My current custom is to declare
variables like that with "STATIC int foo;" and then feed the compiler
something suitable with a -DSTATIC=whatever.
-- 
				Henry Spencer @ U of Toronto Zoology
				{allegra,ihnp4,decvax,pyramid}!utzoo!henry



More information about the Comp.lang.c mailing list