This is the mail archive of the 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]

Re: gcc 3.0.1 & C++ ABI issues

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

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