[Nickle] Should I expect this?
Bart Massey
nickle@nickle.org
Tue, 05 Nov 2002 09:19:21 -0800
Thanks!
Note that the syntax for initializing an object consisting
of nested unions is still quite ugly (although much improved
over previous options):
typedef union { int ux; union { int uux, uuy; } uy; } u;
u v = { uy = { uux = 3 } };
I wish I had a suggestion here.
Bart
In message <E18973T-00030O-00@localhost> you wrote:
>
> Around 23 o'clock on Nov 4, Bart Massey wrote:
>
> > <stdin>:2: Initializer type mismatch, type 'union { int x; int y; }'
> >
> > It seems like this ought to work to me. Am I confused?
>
> The {} initializers were only for structs and arrays. But, it's
> reasonable to use them for unions as well; the alternative is to use the
> union constant syntax instead:
>
> > typedef union {int x, y;} u;
> > u v = (u.x) 3;
>
> That duplicates the typename, which is bad.
>
> I've changed the compiler to permit union initialization with {} syntax.
>
> -keith
>
>
>
> _______________________________________________
> Nickle mailing list
> Nickle@nickle.org
> http://nickle.org/mailman/listinfo/nickle
>