Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!hsdndev!cmcl2!adm!smoke!gwyn From: gwyn@smoke.brl.mil (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: Redeclaration of Variables extern/static Keywords: scope, ibm, c news Message-ID: <15775@smoke.brl.mil> Date: 10 Apr 91 04:08:54 GMT References: <^R+_H3-@uzi-9mm.fulcrum.bt.co.uk> <1243@airs.UUCP> <1991Apr9.055250.24257@world.std.com> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 12 In article <1991Apr9.055250.24257@world.std.com> geoff@world.std.com (Geoff Collyer) writes: >>>C News, amongst other things, has declarations of ``extern int foo;'' in >>>either a header or towards the top of a file, and later has ``static int >>>foo;''. >this is an ugly case. Some Classic compilers (including the original one, >if memory serves) can't cope with forward static declarations at all. I've never seen a UNIX C compiler that had a problem with multiple declarations of the same object with static linkage, so long as all declarations of the object included the "static" storage specifier. It's the mixing of "extern" and "static" that causes the trouble, but then there is no reason to do that in the first place.