initialize an array of union types

Hi,

I'm trying to the use the C99 designated initializer feature to initialize an array of union types, but I'm getting a compiler error as shown below. Am I using the correct syntax?

[code]#include <stdio.h>

union U

{

struct {int data;} a;

struct {int type; float data;} b;

};

int

main()

{

union U x = {.b.type = 2, .b.data = 1.0};

union U y[] = {{.b.type = 2, .b.data = 1.0}};

fprintf(stderr, "x b data: %f\n",x.b.data);

fprintf(stderr, "y b data: %f\n", y[0].b.data);

return 0;

}[/code]

% cc u.c

"u.c", line 13: structure/union designator used on non-struct/union type

"u.c", line 13: structure/union designator used on non-struct/union type

cc: acomp failed for u.c

% cc -Version

cc: Sun C 5.9 DEV 2006/06/08

%

[867 byte] By [cl2rsdn] at [2007-11-26 9:15:32]
# 1
[code] union U x = { .b = { .type = 2, .data = 1.0 } };union U y[] = {{.b = { .type = 2, .data = 1.0}}};[/code]
horsh at 2007-7-6 23:40:46 > top of Java-index,Development Tools,Solaris and Linux Development Tools...