Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.c++.moderated    |    Moderated discussion of C++ superhackery    |    33,346 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 33,064 of 33,346    |
|    Wil Evers to Francis Glassborow    |
|    Re: [Solved] sequence of inheritance fro    |
|    20 May 13 12:45:13    |
   
   From: bouncer@dev.null   
      
   Francis Glassborow wrote:   
   > On 20/05/2013 00:39, Wil Evers wrote:   
   >> Francis Glassborow wrote:   
   [...]   
   >>> IIUC, the implementation is at liberty to lay out a derived class'   
   >>> base classes anyway it likes. There are, IIRC, some limitations on   
   >>> the relationship between a pointer to the derived class and a   
   >>> pointer to the first base class in the declaration of the derived   
   >>> class.   
   >>   
   >> Are you sure? As far as I know, if we have...   
   >>   
   >> class Base { /* ... */ };   
   >> class Derived : public Base { /* ... */ };   
   >>   
   >> ...then for a Derived object, the compiler is free to either use a   
   >> layout in which the Base part comes first, or one in which the   
   >> Derived part comes first (which would not be very practical, but   
   >> that's beside the point).   
   >>   
   >> I think the lesson to learn from this thread is that a void pointer   
   >> obtained from the address of an X must not be cast back to a   
   >> pointer to some other type, even if that other type is closely   
   >> related to X.   
   >   
   > static_cast
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca