This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: RFC: Update Intel386, x86-64 and IA MCU psABIs for passing/returning empty struct
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- Cc: Florian Weimer <fw at deneb dot enyo dot de>, GCC Development <gcc at gcc dot gnu dot org>, cfe-commits <cfe-commits at lists dot llvm dot org>
- Date: Mon, 8 Feb 2016 08:17:32 -0800
- Subject: Re: RFC: Update Intel386, x86-64 and IA MCU psABIs for passing/returning empty struct
- Authentication-results: sourceware.org; auth=none
- References: <CAMe9rOofYT89yzF6jxFZFG2=QVQuQpEC7DP0HV_epjeawCf_sA at mail dot gmail dot com> <87d1s8wc4w dot fsf at mid dot deneb dot enyo dot de> <CAMe9rOp_6ZpR1YSJZ7AiLpa+FPRGJoLm5fTPkiH5BgF4Tkg3RA at mail dot gmail dot com> <87r3gouvv2 dot fsf at mid dot deneb dot enyo dot de> <CAMe9rOo2tPZKZEgpgFbbSnkyBiONzS9vfntn_QsxRPbVHZGmUw at mail dot gmail dot com> <87k2mgutzr dot fsf at mid dot deneb dot enyo dot de> <CAMe9rOoMujhjExxKWrz-Dv8uE33X=Upvi_X_HZsfeN0GS+=56A at mail dot gmail dot com> <CAMe9rOruCOvtM2D2AmG94A1_8Og8Kfu7tYF4De=XNfzUG+eh5g at mail dot gmail dot com> <CAH6eHdQci21ZhZ4odOfJRjC8s8HjuJ5X73LfK6oqvxCtOnzK6w at mail dot gmail dot com> <CAMe9rOpJXNUNvusTmwFb3riOxXyXLTGTquSMKqZkBe=nbmt_QQ at mail dot gmail dot com> <CAH6eHdQcvj7EY3jXgtUBQePfikiTbcuqsNFpDH7SWyxD628peQ at mail dot gmail dot com> <CAMe9rOryQ0eHUGdyaEHJZuuoNFO0fdgUwqZ+zo-AaDQ+eSi=9A at mail dot gmail dot com> <CAH6eHdQzgXej8sSVzY7by+Ju6zPbBqt7=M3i60OKSP0vxrnGgQ at mail dot gmail dot com>
On Mon, Feb 8, 2016 at 8:15 AM, Jonathan Wakely <jwakely.gcc@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.
- References:
- RFC: Update Intel386, x86-64 and IA MCU psABIs for passing/returning empty struct
- Re: RFC: Update Intel386, x86-64 and IA MCU psABIs for passing/returning empty struct
- Re: RFC: Update Intel386, x86-64 and IA MCU psABIs for passing/returning empty struct
- Re: RFC: Update Intel386, x86-64 and IA MCU psABIs for passing/returning empty struct
- Re: RFC: Update Intel386, x86-64 and IA MCU psABIs for passing/returning empty struct
- Re: RFC: Update Intel386, x86-64 and IA MCU psABIs for passing/returning empty struct
- Re: RFC: Update Intel386, x86-64 and IA MCU psABIs for passing/returning empty struct
- Re: RFC: Update Intel386, x86-64 and IA MCU psABIs for passing/returning empty struct
- Re: RFC: Update Intel386, x86-64 and IA MCU psABIs for passing/returning empty struct
- Re: RFC: Update Intel386, x86-64 and IA MCU psABIs for passing/returning empty struct
- Re: RFC: Update Intel386, x86-64 and IA MCU psABIs for passing/returning empty struct
- Re: RFC: Update Intel386, x86-64 and IA MCU psABIs for passing/returning empty struct
- Re: RFC: Update Intel386, x86-64 and IA MCU psABIs for passing/returning empty struct