union initialization
utzoo!decvax!duke!harpo!seismo!hao!menlo70!sytek!zehntel!tektronix!tekmdp!bronze!grahamr
utzoo!decvax!duke!harpo!seismo!hao!menlo70!sytek!zehntel!tektronix!tekmdp!bronze!grahamr
Fri Dec 17 16:04:06 AEST 1982
Consider the declaration
union utag {
char *p;
char c[4];
};
Currently, initialization of unions is not allowed by the
language. How about allowing initialization with this:
union utag u.c = "foo";
It would declare u and initialize the bits in it that belong
to member c as shown. Leftover bits are set to 0. This syntax
naturally disallows initialization of more than one member.
More information about the Comp.lang.c
mailing list