Boost logo

Boost :

From: Michael Marcin (mmarcin_at_[hidden])
Date: 2007-11-03 19:49:57


Peter Dimov wrote:
> Sebastian Redl:
> ...
>
>>> and the standard requires a reinterpret_cast to yield a pointer to the
>>> first
>>> element (9.2/17).
>>>
>> The standard says no such thing. It speaks of a pointer "suitably
>> converted". It doesn't say that reinterpret_cast is such a suitable
>> conversion; in fact, the definition of reinterpret_cast itself makes it
>> very clear that it is not.
>
> The sentence is
>
> A pointer to a POD-struct object, suitably converted using a
> reinterpret_cast, points to its initial member (or if that member is a
> bit-field, then to the unit in which it resides) and vice versa.
>
> Note the "using a reinterpret_cast" part that immediately follows the
> "suitably converted" part.
>

I'm not sure what "suitably converted" means but if the compiler has
enough information to prove that a type is not a POD-struct then what
relevance does this have? If none than it must also have no relevance to
generic programming.

The cast chain is very ugly, hard to read, and is certainly not self
documenting. Perhaps this is a spot for another utility cast?

Thanks,

Michael Marcin


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