Boost logo

Boost :

Subject: Re: [boost] [optional] Strict Aliasing Warnings on Trunk
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2009-12-18 03:11:23


On Thu, Dec 17, 2009 at 11:17 PM, Dean Michael Berris
<mikhailberis_at_[hidden]> wrote:
>>>> To someone who doesn't know the
>>>> semantics of reinterpret_cast, perhaps the warning has some value, but
>>>> for the rest of us what it really says is "Warning! You have used
>>>> reinterpret_cast!"
>>>
>>> Sure, but isn't reinterpret_cast considered bad because of the fact
>>> that there is no standard implementation of it?
>>
>> I'm not sure what you mean. There is a standard implementation of
>> reinterpret_cast.
>
> Really? I thought this was implementation-defined?

Sure, but it is specified that if you reinterpret_cast from T1* to
T2*, then reinterpret_cast the resulting T2* back to T1*, you'll get
the original value (as long as T2 doesn't have stricter alignment
requirements.)

Reinterpret_cast is tricky but it is part of the language and it's
lame for the compiler to warn when it is used.

Emil Dotchevski
Reverge Studios, Inc.
http://www.revergestudios.com/reblog/index.php?n=ReCode


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk