$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] [config] RFC PR 82
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2015-12-01 09:59:11
On 2015-12-01 17:18, AgustÃn K-ballo Bergé wrote:
>
> But what tops it all, what makes this decision a plain and simple
> mistake, is that this "just works" because implementations map this kind
> of undefined behavior into specific well-defined behavior. So it's just
> undefined behavior for the sake of "pretty syntax" (a subjective thing
> at best). Why then wouldn't you just simply write that well-defined code
> that these implementations are translating to?
It's not just syntax. If I'm not mistaken, the union-based type punning
has advantage over memcpy - it allows the code to be constexpr.
memcpy also has potential to be a function call instead of a few
instructions (or no instructions at all). I know many compilers are
aware of memcpy and optimize it, but that's not something one can rely on.