[ub] bit_cast
Chandler Carruth
chandlerc at google.com
Mon Nov 4 19:56:20 CET 2013
On Mon, Nov 4, 2013 at 10:42 AM, Gabriel Dos Reis <gdr at microsoft.com> wrote:
> | -----Original Message-----
> | From: ub-bounces at open-std.org [mailto:ub-bounces at open-std.org] On
> Behalf Of
> | Lawrence Crowl
> | Sent: Monday, November 4, 2013 10:40 AM
> | To: WG21 UB study group
> | Subject: Re: [ub] bit_cast
> |
> | The intent is to provide an alternative to the idiom
> |
> | int i; float f = *(float*)&i;
> |
> | The usual objection is "but memcpy is slow".
> | The answer is "your compiler is better than you think".
>
> If we give it enough latitude in terms of non-aliasing :-)
The compiler needs no latitude to optimize using memcpy to do this.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.open-std.org/pipermail/ub/attachments/20131104/b4ab4587/attachment.html
More information about the ub
mailing list