local extern : MS vs. the world

carroll at s.cs.uiuc.edu carroll at s.cs.uiuc.edu
Wed Oct 26 03:20:00 AEST 1988


Small note - MS C actually found a bug that a number of other compilers
didn't. In porting code from UNIX to my AT, the compiler choked on code
that compiled fine on UNIX. The problem was that it had declared
	extern long int mem_size
inside several functions, but used it in a function in which it had not
been declared. We had previously compiled this on Sun3.4, 4.3BSD on RT's,
SysV on 3b2's and 3b20's, and a Sequent. Not one of these caught the error.
Apparently they take 'extern' declarations to be global to the file, even
if the declaration is local to a function. I agree with MS on this one -
local 'extern' declarations *should* be local. Any comments?

Alan M. Carroll          "How many danger signs did you ignore?
carroll at s.cs.uiuc.edu     How many times had you heard it all before?" - AP&EW
CS Grad / U of Ill @ Urbana    ...{ucbvax,pur-ee,convex}!s.cs.uiuc.edu!carroll



More information about the Comp.lang.c mailing list