Am Dienstag, 11. März 2008 15:39:33 schrieb Giel van Schijndel: > Dennis Schridde schreef: > > Am Dienstag, 11. März 2008 08:43:03 schrieb Per Inge Mathisen: > >> 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? > > > > It could, and it would be just another form of uglyness, imo. > > Wasn't that your proposal? Or did I interpret that wrongly? I did not think about casting from base- to upper-class. Only about the reverse. This is why my proposal completely missed that problem.
--Dennis
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Warzone-dev mailing list Warzone-dev@gna.org https://mail.gna.org/listinfo/warzone-dev