From: Anthony Williams (anthony.williamsNOSPAM_at_[hidden])
Date: 2002-12-05 07:03:25
Gabriel Dos Reis writes:
> Anthony Williams <anthony.williamsNOSPAM_at_[hidden]> writes:
> | 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."
> | So given a Foo object foo, static_cast<char*>(static_cast<void*>(&foo)) is
> | legal, and can be used to access the object representation of the object.
> There is no question that the above cast is legal. I thin the issue
> is elsewhere. The key question is whether that may be different from
I thought the issue was whether the pair of static_cast<>s in dangerous_cast<>
was as implementation defined as a reintepret_cast<> would be. If you read my
mail to the end, hopefully I have explained that I think that the
static_cast<> pair is legal and well-defined, as opposed to using
reinterpret_cast, which is implementation-defined. If I haven't made myself
clear, I apologise, and will try again.
-- Anthony Williams Senior Software Engineer, Beran Instruments Ltd. Remove NOSPAM when replying, for timely response.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk