struct comparison

Guy Harris guy at auspex.auspex.com
Wed Jul 26 10:10:37 AEST 1989


>Just like the compiler doesn't have enough information to
>initialize a union, right? !
>
>A simple rule like comparing first members of unions and the
>pointers themselves would work nicely in a lot of cases and
>match the way initialization works.

Uh, as far as I'm concerned, the "first member" rule's only use is to
give a meaning to the default initialization of unions.  It means I
can't initialize, say, an array of union types or objects containing
union types if different elements of that array have different union
members "active", for example (e.g., a symbol table, with symbols
having, say, string, integral, or floating-point values, selected by a
discriminator - if I want the initial symbol table to have values of
more than one type, I lose).

Had it not been for the necessity of giving *some* meaning to
initialization of unions, I'd just as soon have left initialization of
them undefined....



More information about the Comp.std.c mailing list