[Nickle] Should I expect this?

Keith Packard nickle@nickle.org
Tue, 05 Nov 2002 08:59:55 -0800


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