C++ Logo

sg12

Advanced search

Re: [ub] Type punning to avoid copying

From: Gabriel Dos Reis <gdr_at_[hidden]>
Date: Thu, 25 Jul 2013 17:45:40 -0500
Jeffrey Yasskin <jyasskin_at_[hidden]> writes:

[...]

| I don't quite agree that "One also needs something for the memcpy()
| back into x, saying that does not yield a trap representation". At
| least, it doesn't need to be a rule in the language for all
| implementations. If the value representation of a type is
| implementation-defined, then the programmer can cooperate with her
| implementation to ensure she doesn't create a trap representation,
| even if another implementation running the same code would trap.

Indeed, my original formulation is probably stronger than needed.
However, I suspect some wording is required to cover the "making up of the
non-trap value representation of T" outside of an object of type T.

-- Gaby

Received on 2013-07-26 00:45:56