Proper use of "extern" ...

David Keppel keppel at pavepaws.berkeley.edu
Sun Jun 8 10:27:24 AEST 1986


In article <223 at comp.lancs.ac.uk> david at comp.lancs.ac.uk (David Coffield) writes:
[ forward declaration of a static function: use static or extern keyword? ]
>
>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?

	Since static means (more or less) 'local', I'd vote for 'static',
    since it tells you right away that the declaration is somewhere *in
    this file*, whereas 'extern' tells you to *look elsewhere*.

	How does this match with 'standard practice'?
----
    :-D avid  K eppel				    ..!ucbvax!pavepaws!keppel
		"Learning by Osmosis: Gospel in, Gospel out"



More information about the Comp.lang.c mailing list