Boost logo

Boost :

Subject: Re: [boost] Proposed templated integer_sort
From: David Abrahams (dave_at_[hidden])
Date: 2008-12-16 16:17:10


on Tue Dec 16 2008, "Giovanni Piero Deretta" <gpderetta-AT-gmail.com> wrote:

> On Tue, Dec 16, 2008 at 3:03 PM, Pyry Jahkola <pyry.jahkola_at_[hidden]> wrote:
>> Gevorg Voskanyan wrote:
>>>
>>> I suggest modifying CastFloatIter() function to use memcpy for accessing
>>> floats as integers, as shown below:
>>
>> Hmm, I don't think it's any better than reinterpret casting.
>
> Yes it is. It has the nice property of not leading to UB.

If so, that surprises me. Is it really guaranteed that all valid
floating-point bit patterns are also valid integer bit patterns?

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk