|
Boost : |
From: John Maddock (john_at_[hidden])
Date: 2008-02-26 11:52:53
Martin Bonner wrote:
> I'm not sure I'm a pedantic language lawyer, but the standard says
> "In a union, at most one of the data members can be active at any
> time". It is quite clear that experts in CLC++M regard John
> Maddock's version of setbits and getbits as undefined behaviour. In
> general, I would regard using undefined behaviour as unacceptable for
> a boost library. The floating point utilities are different, they
> pretty much /have/ to use undefined behaviour. They also seem to be
> taking the correct approach of using #ifdef, and testing on as many
> platforms as possible (I haven't reviewed them yet).
>
> On the other hand, even if floating point utilities have to go
> through a minefield, there doesn't seem any point in wandering around
> more than necessary. Particularly if the tested compilers don't
> actually generate better code for the undefined behaviour version!
Indeed, suggestion withdrawn! :-)
It all goes to show why I don't normally mess about at such a low level :-(
John.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk