$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: David Abrahams (dave_at_[hidden])
Date: 2002-10-07 14:30:23
"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.
> In this case I am not even casting
> away or applying constness to the underlying type though, so is there still
> a potential problem using reinterpret_cast<> to do this?
In portable code, yes. Why is it so hard for people to understand this?
**** 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?
-- David Abrahams * Boost Consulting dave_at_[hidden] * http://www.boost-consulting.com