This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: strict aliasing violation
On 25 January 2010 15:51, Piotr Wyderski:
> Andrew Haley wrote:
>
>>>> ? union { float f; uint32 i; } u = {.f = v};
>>>> ? return u.i;
>>>
>>> Nope, that is not allowed either.
>>
>> Of course it is allowed. ?It's a legitimate gcc extension, and it's
>> supported by many other compilers too.
>
> It's a C extension, according to the documentation.
> In C++ mode (-std=gnu++0x) the compiler does not
> understand the "u = {.f = v}" statement. Is it a feature
> or a bug? ;-)
A feature; the C++ committee decided not to support designated initializers.