New C++ ABI and -freg-struct-return?

Jamie Lokier egcs@tantalophile.demon.co.uk
Thu Jun 22 05:21:00 GMT 2000


Ralph Loader wrote:
> This would make some common C++ coding styles, such as smart pointer
> classes (and less common ones, like my GF(2^n) calculator :-) ), have
> less overhead.

As well as the style where a class contains a single integer or float...

> There is a 'minor' complication - we wouldn't want to break
> compatibility between C++ and C - so the rule would have to be
> something like:
> 
>    if a class (or struct) has a method (or is otherwise not a C
>    datatype), and fits into a register, then it is returned in a
>    register.

Another idea with more flexibility is a per-struct/class type attribute
that says whether to use a register or not.  It should be inherited of
course.

-- Jamie


More information about the Gcc mailing list