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
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+
On Mon, Jan 25, 2010 at 3:42 PM, Erik Trulsson wrote:
> On Mon, Jan 25, 2010 at 02:19:04PM +0100, Richard Guenther wrote:
>> On Mon, Jan 25, 2010 at 1:24 PM, Piotr Wyderski
>> wrote:
>> > I have a hash function hash(T v) overloaded for
>> > all integral types. I want to provide a variant for
>> >
On 01/25/2010 02:42 PM, Erik Trulsson wrote:
> On Mon, Jan 25, 2010 at 02:19:04PM +0100, Richard Guenther wrote:
>> On Mon, Jan 25, 2010 at 1:24 PM, Piotr Wyderski
>> wrote:
>>> I have a hash function hash(T v) overloaded for all integral
>>> types. I want to provide a variant for float and doubl
On Mon, Jan 25, 2010 at 02:19:04PM +0100, Richard Guenther wrote:
> On Mon, Jan 25, 2010 at 1:24 PM, Piotr Wyderski
> wrote:
> > I have a hash function hash(T v) overloaded for
> > all integral types. I want to provide a variant for
> > float and double, which should work as follows:
> > take the
On Mon, Jan 25, 2010 at 1:24 PM, Piotr Wyderski
wrote:
> I have a hash function hash(T v) overloaded for
> all integral types. I want to provide a variant for
> float and double, which should work as follows:
> take the floating-point value, treat its binary
> representation as uint32_t/uint64_t a
Piotr Wyderski writes:
> However, GCC warns me about strict aliasing
> rules violation, which is technically correct, but
> in this case is intended. How do I perform this
> conversion ina GCC-friendly way? Even that
> produces a warning:
>
> inline hash_type hash(float v) {
>
> retur