This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: mutually-recursive types and an old puzzle


Joe Buck wrote:
ABIs that don't allow most STL iterators to be returned in a register
are, IMHO, broken.  Unfortunately, it appears that we are stuck with
some broken ABIs.
Non-POD objects are those that can 'magically' be placed in
lists and stuff. Where by 'magical' I mean 'by code the compiler must call
but cannot see in the current translation unit'.  Therefore the compiler
cannot go changing the address of such objects (or placing them in places
that have no address).

The actual C++ ABI makes the observation that it is the non-trivial copy
constructor and non-trivial destructor that have this magical property, and
hence only classes with either of those declared cannot be placed in
registers.

The problem with C++ is that if you declare *any* constructor, you have
to declare the copy constructor (if you want one), and if you declare it,
it's non-trivial.  You need to be able to say 'make me the default copy
ctor'.

Of course, if the underlying C ABI cannot pass structs in registers, you're
out of luck anyway.

nathan

--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]