Two C compiler questions

Guy Harris guy at rlgvax.UUCP
Sun Aug 7 18:41:55 AEST 1983


1) What is the "poor, and in some cases, incorrect, code" that was generated
by the System III (and 4.1BSD) VAX-11 C compiler before it was changed to
ignore advice to put scalars shorter than 32 bits into a register?  The
main difference in the System III compiler (which I assume is the "before"
picture) and the 4.1BSD compiler (which I assume is the "after" picture)
in this regard is that the System III compiler has some code that looks sort
of like it lengthens any such declaration to "int", while the 4.1BSD compiler
just ignores the "register" part.

2) If you declare a structure in the fashion

	struct foo {
		int foo;
		int bar;
	} foo[1];

and then reference foo[0].foo as

	foo->foo;

the System III/4.1BSD PCC complains about "struct/union or struct/union
pointer required".  Some people here use this coding style, and object that
since an unsubscripted reference to an array should refer to the address
of that array, this construct is perfectly legitimate.  PCC, however, requires
that the object be a pointer, and does not consider a reference to an array
to be equivalent.  Is this a bug or a feature of PCC?

	Guy Harris
	{seismo,mcnc,we13,brl-bmd,allegra}!rlgvax!guy



More information about the Comp.lang.c mailing list