[Nickle] array of union initializer syntax

Keith Packard keithp at keithp.com
Sat Dec 29 12:57:11 PST 2007

We currently require that unions be initialized with braces around them:

	typedef union {
		int i;
		real r;
	} n_t;

	n_t x = { .i = 7 };

When you stick this in an array, it looks messy:

	n_t[*] r = { { .i = 7 }, { .r = 1.5 } };

Sure seems like it would be nice if this could be

	n_t[*] r = { .i = 7, .r = 1.5 };

This isn't a trivial change as the grammar has a strong separation
between struct/union and array initializers. All of that would need to
become semantic instead, which will probably clean things up quite a

Would this be a useful change?

keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : /pipermail/nickle/attachments/20071229/635087c2/attachment.pgp 

More information about the Nickle mailing list