Proper use of "extern" ...
David Coffield
david at comp.lancs.ac.uk
Fri Jun 6 03:53:04 AEST 1986
Right.
Suggestions, please, as to the correct use of "extern" in the
following scenario:
A file has two functions in it, "f" and "g", thus
static void f()
{
g();
}
static void g()
{
}
f uses g and g is declared after f (I know we can put g before
f and the following is no longer applicable but ...).
At the top of this file do we put
a) static void g() or
b) extern void g()? (extern static must be meaningless).
My understanding (this varies with the book you read) of "extern" is that
it means the object is declared "later in this file or in another file" in
which case I vote for (b). Is this right?
--
"the secret of success is compost"
uucp: ...!mcvax!ukc!dcl-cs!david post: Department of Computing
arpa: david%lancs.comp at ucl.cs University of Lancaster, UK
janet: david at uk.ac.lancs.comp phone: +44 524 65201 x 4599
More information about the Comp.lang.c
mailing list