Empty class passing

Mark Mitchell mark at codesourcery.com
Wed Dec 13 15:51:14 UTC 2000


>>>>> "Jason" == Jason Merrill <jason at redhat.com> writes:

    >> In particular, after polling lots of C++ experts, it turns out
    >> that nobody cares about optimizing empty class passing.

    Jason> Nobody may care in the abstract, but STL uses empty classes
    Jason> quite a bit (for iterator tags), and passes them to

Right.  The consensus from the people I talked to (mostly various
kinds of generic programming people) was that there are two cases:

  - The function is inline.  In that case, the paramter should
    be optimized away by the compiler.

  - The function is not inline.  In that case, the function call
    overhead dwarfs the use of one additional register.

Obviously, there is bound to be some pathological example involving
tons and tons of empty parameters to a single function where this
isn't true, but I think the idea is right in principle.

    Jason> functions, so I still think it's useful to optimize.  But
    Jason> perhaps not in a way that affects the ABI; your change
    Jason> sounds fine to me.

Good.

--
Mark Mitchell                   mark at codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com




More information about the cxx-abi-dev mailing list