From: Eric Woodruff (Eric.Woodruff_at_[hidden])
Date: 2002-12-05 11:19:57
"Anthony Williams" <anthony.williamsNOSPAM_at_[hidden]> wrote in
> Gabriel Dos Reis writes:
> unsigned char* has _additional_ properties to void* --- you can access the
> object representation of _any_ object through an unsigned char* (and for
> you can copy them around using this)
> "The object representation of an object of type T is the sequence of N
> unsigned char objects taken up by the object of type T, where N equals
> "If a program attempts to access the stored value of an object through
> lvalue of other than one of the following types the behavior is
> - the dynamic type of the object,
> - a char or unsigned char type."
> Thus, given that h.storage is properly aligned, (which is the purpose of
> other union member), after "new(h.storage) Foo", h.storage contains a Foo
> object. Thus accessing it through a pointer-to-Foo is legal, as Foo is the
> dynamic type of the object.
This is precisely my reasoning why reinterpret_cast<> is _not_
It must be the case that it is equal to the situation of having
Foo* -> char */void* -> Foo* if Foo is the dynamic type of the object.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk