Mark Dickinson added the comment:

In case anyone wants to have a go at interpreting the standard, the most 
immediately relevant part is the footnote to C99+TC3 6.5.2.3p3:

"""
If the member used to access the contents of a union object is not the same as 
the member last used to store a value in the object, the appropriate part of 
the object representation of the value is reinterpreted as an object 
representation in the new type as described in 6.2.6 (a process sometimes 
called "type punning"). This might be a trap representation.
"""

Trap representations could potentially cause undefined behaviour, but are 
highly unlikely to occur in practice for us for this particular case, so I 
don't think they can possibly serve as the excuse for clang's behaviour.

The "reinterpreted as ..." language here strongly suggests that the union trick 
should be supported.

OTOH, this is just a footnote, so not normative ...

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30124>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to