David Abrahams <[EMAIL PROTECTED]> writes: | Gabriel Dos Reis <[EMAIL PROTECTED]> writes: | | > Thanks for your patience. | > | > Now, imagine an implementation where the original type is remembered, | > then dereferencing the pointer obtained from | > | > char* -> void* -> T* | > | > may just eject you into the outer space. | | Is remembering the original type _of_ _the_ _pointer_ actually legal?
Why wouldn't it be valid for an implementation to remember the orginal type of the object from which the pointer is obtained? 1.8/1 [...] Some objects are polymorphic (10.3); the implementation generates information associated with each such object that makes it possible to determine that object s type during program execution. For other objects, the interpretation of the values found therein is determined by the type of the expressions (clause 5) used to access them. Since an implementation is already required to generate information to assist evaluations of polymorphic objects; what can't it do the same for non-polymorphic objects, as an extension? | Can you quote chapter and verse on this? Since: 1.9/1 [...] This International Standard places no requirement on the structure of conforming implementa-tions. [...] you don't expect me to quote chapter and verse from the Standard; do you? ;-) | I thought the implementation | was only permitted to eject you if you use a pointer where the actual | type _of_ _the_ _pointee_ is wrong. Undefined behavior may also be expected when this International Standard omits the description of any explicit definition of behavior. There is no explicit description that after the trip char* -> void* -> Foo* starting at h.storage, one can safely dereference the resulting pointer. -- Gaby _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost