Who says infinite structures are impossible?

west at sdcsla.UUCP west at sdcsla.UUCP
Fri Jul 27 08:33:20 AEST 1984


Hey, that one was fun with dbx ("print s")!!

But seriously, it is clearly a compiler fault, since the "C Reference Manual"
clearly states (section 8.5, page 197):
	... names of tags and members must be mutually distinct.

The example structure (given here
	struct x {
		int a;
		struct x { int b,c;} f;
		} s;
for clarity) contains a structure with the same structure tag name as is
given the whole structure.

No scoping of these names within structures is implied, nor should any
be inferred.

It is unfortunate that both the C compiler (cc on 4.2bsd) and lint
let this go by, and in fact give misleading warnings about "s.f.b"
and "s.f.c" having illegal members.

In short, I'd never belong to any structure that had itself as a member.

	-- Larry West, UC San Diego, Institute for Cognitive Science
	-- decvax!ittvax!dcdwest!sdcsvax!sdcsla!west
	-- ucbvax!sdcsvax!sdcsla!west
	-- west at NPRDC		{{ NOT: <sdcsla!west at NPRDC> [aarg!] }}



More information about the Comp.lang.c mailing list