(inline)

"Anthony Williams" <[EMAIL PROTECTED]> wrote in
message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

[snip]
> 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
PODs,
> you can copy them around using this)
>
> 3.9p4:
>   "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
>   sizeof(T)."
>
> 3.10p15:
>   "If a program attempts to access the stored value of an object through
an
>   lvalue of other than one of the following types the behavior is
undefined:
>
>   - the dynamic type of the object,
>
>   ...
>
>   - a char or unsigned char type."
>

[snip]

> Thus, given that h.storage is properly aligned, (which is the purpose of
the
> 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_
implementation defined.

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.

[snip]






_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to