Redeclaration of Variables extern/static

Geoff Collyer geoff at world.std.com
Tue Apr 9 15:52:50 AEST 1991


Ian G Batten:
>>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;''.

ANSI compilers are a low-priority problem for us.  We prefer to write
code that ANSI and Classic compilers can accept (without ifdefs), but
this is an ugly case.  Some Classic compilers (including the original one,
if memory serves) can't cope with forward static declarations at all.

Henry's opinion (I hope I'm not misquoting him) is that there are certain
cases that ANSI doesn't cover either (forward static arrays, as I recall).
The whole situation is a mess; we may just try to rearrange declarations
to avoid forward static declarations altogether.

Ian Lance Taylor:
>Still, in the long run it would probably be better to change the code (I
>have no idea what that would involve).

Indeed.  But to what?
-- 
Geoff Collyer		world.std.com!geoff, uunet.uu.net!geoff



More information about the Comp.lang.c mailing list