Article View: gnu.g++.bug
Article #1756G++ 1.34.1+ named return values
From: rjc
Date: Sun, 19 Mar 1989 21:24
Date: Sun, 19 Mar 1989 21:24
36 lines
1565 bytes
1565 bytes
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!
Technical Details
Message-ID:
<21998@shemp.CS.UCLA.EDU>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!nih-csl!elsie!cvl!haven!purdue!decwrl!ucbvax!tut.cis.ohio-state.edu!bloom-beacon!oberon!ucla-cs!rjcShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!nih-csl!elsie!cvl!haven!purdue!decwrl!ucbvax!tut.cis.ohio-state.edu!bloom-beacon!oberon!ucla-cs!rjc From: rjc@maui.cs.ucla.edu Newsgroups: gnu.g++.bug Subject: G++ 1.34.1+ named return values Message-ID: <21998@shemp.CS.UCLA.EDU> Date: 19 Mar 89 21:24:41 GMT Sender: news@CS.UCLA.EDU Reply-To: rjc@CS.UCLA.EDU () Distribution: gnu Organization: UCLA Computer Science Department Lines: 36