Boost logo

Boost :

From: Philippe A. Bouchard (philippeb_at_[hidden])
Date: 2002-08-07 22:35:00


> > > 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.

Philippe A. Bouchard


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