$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] [config] RFC PR 82
From: Alexander Lauser (alxlaus_at_[hidden])
Date: 2015-11-25 10:32:39
Am 25. November 2015 01:02:25 MEZ, schrieb Gavin Lambert <gavinl_at_[hidden]>:
>On 25/11/2015 10:03, Andrey Semashev wrote:
>> On 2015-11-24 23:54, AgustÃn K-ballo Bergé wrote:
>>> On 11/24/2015 5:20 PM, Andrey Semashev wrote:
>>>>>> Ditto BOOST_HAS_UNION_TYPE_PUNNING_TRICK (doesn't any compiler
>support
>>>>>> this?).
>>>>>
>>>>> 'I'm all with you on this one' but since 'it is not in the
>standard'
>>>>> language purists will probably complain if it is used
>>>>> unconditionally...
>>>>
>>>> To some extent this is guaranteed by [class.union]/1 in C++11.
>>>
>>> No, it isn't.
>>
>> Why? Reading different members of the standard layout union within
>the
>> common initial sequence is enough to implement a bitwise_cast.
>
>I don't have a standard reference handy, but I'm pretty sure that
>reading from a different member of a union than was written to is still
>
>explicitly UB -- although for practical reasons *most* compilers will
>generate the expected result provided that the two types have the same
>initial alignment.
http://en.cppreference.com/w/cpp/language/union have an example that explicitly states what Gavin claimed. Not sure about the reliability of that site, though.
Best,
Alexander