|
Boost : |
From: Hillel Y. Sims (hsims_at_[hidden])
Date: 2002-10-07 16:00:44
"David Abrahams" <dave_at_[hidden]> wrote in message
news:uofa6yrlc.fsf_at_boost-consulting.com...
> "Hillel Y. Sims" <hsims_at_[hidden]> writes:
>
> > I guess I could write that as "return
> > *static_cast<Row<iterType2>*>(static_cast<void*>(this));" instead (that
> > hadn't actually occurred to me before).
>
> Right. And if you're pointing at data that is layout-compatible
> according to the standard, it's guaranteed to work, whereas
> reinterpret_cast is guaranteed to do whatever the implementation
> wants.
I will change my code to use static_cast for the sake of never having to be
concerned about it again. Is a "*(Row<iterType2>*)(this)" C-style cast
(wouldn't that be "safe"?) equivalent in this case to the double-level
static_cast or a reinterpret_cast? (I guess that question could head toward
c.l.c++.m if it's getting off-topic here.)
>
> **** THE BEHAVIOR OF reinterpret_cast IS IMPLEMENTATION-DEFINED ****
>
> Did you look in the documentation of every compiler you're targeting
> to find out what it does?
>
Yes. ;-)
thanks,
hys
-- Hillel Y. Sims FactSet Research Systems hsims AT factset.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk