Per Inge Mathisen schreef:
> On Tue, Mar 11, 2008 at 12:27 AM, Giel van Schijndel <[EMAIL PROTECTED]> 
> wrote:
>>  > Just to nitpick a little bit. You cannot downcast, since the memory
>>  > address points to the child object. Take this example:
>>  Erm to use this example:
>>  typedef struct
>>  {
>>     some_type X;
>>  } a_new_type;
>>  a_new_type Y;
>>  Now my point is that the starting address of Y is _exactly_ the same to
>>  that of Y.X because Y.X is the first struct member of Y.
> Clever, but unless I misunderstand the standard, this casting would
> still violate strict aliasing, though?

Yes, it would still violate strict aliasing like it does now. Though in
this case it would only violate strict aliasing when casting from
base->derived. Either way, I don't think it's worth the trouble.


Attachment: signature.asc
Description: OpenPGP digital signature

Warzone-dev mailing list

Reply via email to