Boost logo

Boost :

From: Sebastian Redl (sebastian.redl_at_[hidden])
Date: 2007-10-12 04:58:49


Roland Schwarz wrote:
> So even in the following case where T is an POD-object type:
>
> struct U { T t; };
>
> and when sizeof(T) == sizeof(U)
>
> I am allowed to:
>
> T t;
> U u1;
> U u2;
>
> memcpy(&t,&u1,sizeof(T);
> memcpy(&u2,&t,sizeof(T);
>
> and rely on u1 == u2, but may not rely on:
> t == u1 or t == u2, because there are no
> guarantees about value representation guarantees
> between U and T.
>
> Correct?
>
Yes, I think this is correct.

Sebastian Redl


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