This is the mail archive of the
mailing list for the GCC project.
Re: gcc 3.0.1 & C++ ABI issues
- To: Joe Buck <jbuck at synopsys dot com>
- Subject: Re: gcc 3.0.1 & C++ ABI issues
- From: Nathan Sidwell <nathan at acm dot org>
- Date: Wed, 08 Aug 2001 10:01:42 +0100
- CC: Jason Merrill <jason_merrill at redhat dot com>, Nathan Sidwell <nathan at codesourcery dot com>, Mark Mitchell <mark at codesourcery dot com>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- References: <200108080104.SAA16048@atrus.synopsys.com>
- Reply-To: nathan at compsci dot bristol dot ac dot uk
Joe Buck wrote:
> Our STL implementation has lots of code where a dummy argument whose type
> is an empty class is used to specialize templates. Are we getting
> pessimization because of this?
Jason's suggested fix to the copy ctor case, does not break the RVO.
Specifically, where A is an empty class,
return A ();
will construct an A directly into the return object area.
What I presume you mean, Joe, is (where T1 == random type, A = empty)
void Foo (T1, A);
Foo (obj1, A ())
The ABI specifies (that provided A is sufficiently POD like),
passing a value parameter of size 1 where A goes. See the ABI doc
3.3 I think. G++ will construct a temporary A (which will be a NOP for
a Pod-like A), and then constructs the (uninitialized) parameter. So
it should end up the same amount of work as if Foo was
void Foo (T1, char);
Foo (obj1, 0);
IIR, we did try passing no parameter for these things, but for some
reason it was very difficult to do so. Mark knows why, more than me.
Dr Nathan Sidwell :: Computer Science Department :: Bristol University
Never hand someone a gun unless you are sure where they will point it
email@example.com http://www.cs.bris.ac.uk/~nathan/ firstname.lastname@example.org