[gnu.g++.bug] G++ 1.34.1+ named return values

rjc@maui.cs.ucla.edu (03/20/89)

Thanks for the explaination (`return;' not `return tmp;').

I would like to suggest/request a little more functionality with named
return values.  Specifically, it would be nice if the parameter names
of the function were visible to the return value declaration.  I would
like to say:
	struct A { ... A(int x); ... };
	A foo(int i) return tmp(i);
	{
		// do stuff to tmp
		return;
	}
rather than:
	struct A { ... A(int x); ... };
	A foo(int i) return tmp(-1);
	{
		tmp = i;	// tmp = A(i)
		// do stuff to tmp
		return;
	}

In general, this will save a constructor/destructor pair whenever the
return value is initialized based on the actual arguments that are
passed to the function.

I have not thought this idea through completely, so there may be good
reasons not to do this.  For me, this would be a big win.

Thanks,
rob collins (rjc@cs.ucla.edu)


-------------------------------------------------------------------------------
rjc@cs.ucla.edu
This is what happens when I sit on my keyboard: AISBDFAORI:KHGEDSYTFBFISKVDJ MN
Next week:  what happens when I throw my keyboard out the window!