Sep 6, 2010 kl. 9:49 PM skrev Francois Pichet:

> Any reason to to disallow flexible array element in union?
> Both gcc 4.5 and msvc allow it. For example:
> struct A
> {
>    int   Length;
>    union
>    {
>        char   dataC[];
>        short  dataS[];
>        long   dataL[];
>    };
> };
> 

Hi Francois,

the reason for it was that it doesn't make sense to have a single union with a 
flexible array element, for example:

union A {
        int a;
        char[] b;
};

but I definitely agree that having them in unions is OK as long as they're 
nested inside another struct (and all fields are flexible array members etc).

- Anders

        
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to