Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!henry From: henry@utzoo.UUCP (Henry Spencer) Newsgroups: comp.lang.c Subject: Re: storage class != Storage Class (Was: Why are typedef names ...) Message-ID: <7420@utzoo.UUCP> Date: Tue, 16-Dec-86 15:53:09 EST Article-I.D.: utzoo.7420 Posted: Tue Dec 16 15:53:09 1986 Date-Received: Tue, 16-Dec-86 15:53:09 EST References: <1092@spice.cs.cmu.edu> <7374@utzoo.UUCP> <6430@alice.uUCp> <3745@utcsri.UUCP>, <193@haddock.UUCP> Organization: U of Toronto Zoology Lines: 16 > ... 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