Standard for union initialization?
Joseph I. Pallas
PALLAS at SU-SCORE.ARPA
Sat Jan 5 04:24:44 AEST 1985
Perhaps I'm out of touch.... An article I read about the draft
standard said the standard would allow initialization of unions, but
the first union field would be the type used for the initialization.
Instead of insisting on
union {
<type1> foo;
<type2> bar;
<type3> mumble;
} baz = <type1 initializer>;
why not use a more general scheme like
union {
<type1> foo;
<type2> bar;
<type3> mumble;
} baz.mumble = <type3 initializer>;
Since no existing compiler that I know of lets you initialize unions
at all currently, there's nothing to be lost by going with the more
flexible system.
joe
-------
More information about the Comp.lang.c
mailing list