Boost logo

Boost :

From: Roland Schwarz (roland.schwarz_at_[hidden])
Date: 2007-10-12 04:47:44


Sebastian Redl wrote:
> The answer is still no. The standard says (9.2/16):

Ok, I think I got the point. I think the situation is even
worse than I initially was thinking of:

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?

Roland aka speedsnail


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