On Mon, Feb 8, 2016 at 8:15 AM, Jonathan Wakely <jwakely....@gmail.com> wrote: > On 8 February 2016 at 16:05, H.J. Lu wrote: >> My understanding is >> >> A type that is standard-layout means that it orders and packs its >> members in a way that is compatible with C. >> >> What is the corresponding compatible type in C? > > An empty structure, such as struct A. > > One of the requirements for standard-layout classes is "has all > non-static data members and bit-fields in the class and its base > classes first declared in the same class" so standard layout classes > are allowed to have base classes, as long as either the base class is > empty (so doesn't alter layout) or the derived class doesn't add > members (so has the same layout as the base). If neither the base > class is an empty record, and the derived class doesn't add any > non-static data members or bit-fields, then the base class should be > an empty record too.
if it is the case struct A { }; struct B { }; struct C : A, B { }; is an empty record. -- H.J.