Shared initial struct elements... history provides an answer?
guido at boring.UUCP
guido at boring.UUCP
Wed Jan 16 00:54:08 AEST 1985
(Re: allowing 'partially qualified references' when a structure element
is unnamed and is itself a structure.)
This proposal doesn't solve any problem.
If we agree that the compiler may not reorder struct elements (i.e., we accept
the status quo), we can just use shared initial struct elements as we have
always done. You can use the preprocessor to ensure that you indeed use
the same set of initial fields in all cases, instead of having to change
the language (slightly).
If the compiler is allowed to reorder elements, we can't even guarantee that
the unnamed substructure ends up in the same place in all structures where
it's used (without another special rule, that is), so it's still unsafe
to inspect the discriminant field.
The idea of parially qualified references in itself is nice, though, and
if introduced generally (using the Cobol or PL/1 rules, for instance),
might also be used for shared portions of larger structures as in the
original proposal.
But I will happily live without it (Ada doesn't have it, if that's an
argument :-).
Guido van Rossum, "Stamp Out BASIC" Committee, CWI, Amsterdam
guido at mcvax.UUCP
More information about the Comp.lang.c
mailing list