[ub] Type punning to avoid copying

Gabriel Dos Reis gdr at axiomatics.org
Fri Jul 26 00:45:40 CEST 2013


Jeffrey Yasskin <jyasskin at google.com> 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


More information about the ub mailing list