is "extern" ambiguous

kvm at basser.UUCP kvm at basser.UUCP
Wed Apr 4 11:51:19 AEST 1984


no

"extern" always means "externally visible".

extern int	i;

declares an externally visible int with name i, it doesn't matter where
the declaration appears.  remember, the default storage class is "extern"
(section 10.2 of the C reference manual) so this is equivalent to

int	i;

similarly

extern int	poot();

or

int	poot();

declares an externally visible function returning int named poot, the
absence of a function body requires that one appear elsewhere.

the ambiguity is in the C compilers which float around.  some compilers
adopt the "restricted environment" (where the explicit appearance of
"extern" means that storage is allocated elsewhere), some just do
incorrect things.



More information about the Comp.unix.wizards mailing list