Boost logo

Boost :

Subject: Re: [boost] Proposed templated integer_sort
From: Ravi (lists_ravi_at_[hidden])
Date: 2008-12-16 18:29:45

On Tuesday 16 December 2008 16:17:10 David Abrahams wrote:
> on Tue Dec 16 2008, "Giovanni Piero Deretta" <> wrote:
> > On Tue, Dec 16, 2008 at 3:03 PM, Pyry Jahkola <pyry.jahkola_at_[hidden]>
> >> 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?

Not true; I am aware of at least one embedded platform where int is 24 bits
whereas float on the same platform is 32 bits. As far as I can tell, the port
of gcc that is used on this platform works fine for C; don't know about C++.


Boost list run by bdawes at, gregod at, cpdaniel at, john at