Thread View: gnu.g++.bug
1 messages
1 total messages
Started by rjc
Sun, 19 Mar 1989 21:24
G++ 1.34.1+ named return values
Author: 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!
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads