4.2 extern a DISASTER (Flame)

VLD/VMB gwyn at BRL.ARPA
Sun Jul 28 10:56:27 AEST 1985


I don't suppose it has occurred to you that if the 4.2BSD C compiler
and linker really had botched the "extern" linkage issue, 4.2BSD
would not run?  The "common" approach to externs is just fine; in
fact Dennis Ritchie has expressed a preference for it over the
"official" (K&R or X3J11) def/ref model.  The way that "ld" handles
named common blocks is, of course, to allocate a single storage
area of size equal to the largest of the blocks having the same
name.  This area can either be explicitly initialized (.data in
effect overrides .lcom) or left uninitialized, in which case the
operating system is obliged to ensure that the area is 0-filled
upon program initialization (on UNIX, the kernel does this upon
exec).

If you are getting core dumps, etc., either your system is
terribly buggy or else you have errors in your code.  In any
case, most releases of UNIX have implemented externs this way.



More information about the Comp.lang.c mailing list