
26 Feb
2008
26 Feb
'08
4 p.m.
Martin Bonner wrote:
Interesting, but I wouldn't do this without the approval of a pedantic langauge lawyer. I have been bitten by this sort of things in the past. And I'm not sure it would make things faster on Visual Studio anyway.
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.
Does anyone know a modern C++ compiler where aliasing through a union doesn't work? Best regards, Stephan