[cxx-abi-dev] Passing an empty class by value
Gabriel Dos Reis
gdr at integrable-solutions.net
Fri Dec 11 10:41:08 UTC 2015
Passing nothing at all is makes the most sense for a vigorous C++ support.
Passing a 1-byte that nothing can possibly read and makes sense of is an
unfortunate sub-optimal codegen.
On Thu, Dec 10, 2015 at 11:05 PM, Marc Glisse <marc.glisse at inria.fr> wrote:
> On Fri, 11 Dec 2015, Nelson, Clark wrote:
>
> It has come to my attention that GCC and clang generate incompatible code
>> for passing an argument of an empty class type.
>>
>> clang seems to completely ignore arguments and parameters of empty class
>> type -- which seems to make a certain amount of sense.
>>
>> OTOH, as far as I understand it, GCC effectively treats an empty class
>> equivalently to a class containing a single member with some character
>> type -- which also seems pretty reasonable.
>>
>> Should the C++ ABI come down on one side or the other of this question?
>>
>
> See A-5 in https://mentorembedded.github.io/cxx-abi/cxx-closed.html for
> some historical discussion.
>
> This is really the sort of question a psABI should settle. But of course
>> the C language doesn't actually support a structure with no members, so
>> it's not too surprising if a psABI doesn't nail down what should happen
>> for this.
>>
>
> Last time I raised this, psABI was also suggested:
> http://sourcerytools.com/pipermail/cxx-abi-dev/2013-November/002627.html
>
> --
> Marc Glisse
>
> _______________________________________________
> cxx-abi-dev mailing list
> cxx-abi-dev at codesourcery.com
> http://sourcerytools.com/cgi-bin/mailman/listinfo/cxx-abi-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sourcerytools.com/pipermail/cxx-abi-dev/attachments/20151211/98739abd/attachment.html>
More information about the cxx-abi-dev
mailing list