storage classes in global declarations

Richard Draves draves at harvard.ARPA
Sat Jan 26 15:25:02 AEST 1985


Our 4.2bsd cc exhibits some remarkably strange behaviour
when given duplicate declarations.  For example:

	static int a;
	static int a;	/* illegal */
	static int f();
	static int f();	/* legal */

	extern int b;
	static int b;	/* legal */
	extern int g();
	static int g();	/* illegal */

	static int c;
	extern int c;	/* legal */
	static int h();
	extern int h();	/* legal */

I can understand different behaviour for variables and functions,
but the other situations I don't understand.  Declaring a variable
both extern and static is legal?  But for functions it's illegal??
But it's legal when you switch the order???

Is this yet another bug in cc, or some strange feature of C?

Rich
-- 

	"If I am conceited, it is the conceit of an amazing man
	 who has never found any surpassing himself."

						Al-Mutanabbi



More information about the Comp.lang.c mailing list