Boost logo

Boost :

From: Greg Colvin (Gregory.Colvin_at_[hidden])
Date: 2002-08-07 22:39:42


At 09:35 PM 08/07/2002, you wrote:
>> > > Isn't it true that get_type_id() make assumptions about the binary
>> layout
>> > > of the class? That is undefined, let alone non-portable.
>> >
>> > Is it a compile-time defined token, not a binary dependency.
>> > [...]
>>
>> If I understand correctly, you assume that the type id is stored
>sizeof(int)
>> bytes before the object. First, I don't see how this could possibly be
>> true,
>> and second, I don't see how this could possible be defined. There are
>> very few guarantees about memory layout, and I don't think any of them
>> cover your uses. If I don't understand your code correctly, perhaps you
>> can explain it in great detail.
>
>Well this issue is based purely on the fact that an integer is always the
>size of a machine word; they will always be aligned with memory. Integers
>are defined this way in the standards.

Not in the C++ standard they aren't.


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