This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
something that would be nice
- From: "Matt Wells" <mwells at gigablast dot com>
- To: <gcc at gcc dot gnu dot org>
- Date: Tue, 11 Nov 2003 15:49:48 -0700
- Subject: something that would be nice
- Organization: Gigablast
- Reply-to: "Matt Wells" <mwells at gigablast dot com>
Hi,
My name is Matt Wells and I'm the sole creator of the internet's soon-to-be
largest search engine, http://www.gigablast.com/ .
I have many functions that return an integer value, positive, zero or
negative so I can't really say "this function returns -1 and
sets errno on error" because -1 is a legit value for my
function to return. Passing in a pointer to the extra value(s) I would like
returned is, in my view, sloppy and potentially confusing.
So my question is... would it be easy to make functions return multiple
values?
For example:
main () {
int value , myerrno ;
value , myerrno = myfunction ( a,b,c );
// or even
( value , myerrno ) = myfunction ( a , b , c );
}
int , int myfunction ( int a , int b , int c ) {
return a + b + c , 0;
// or
return ( a + b + c , 0 );
}
This is more in line with mathematics, too. A function can map
an N dimensional point to an M dimensional point.
What do you guys think about this?
Is it a common request?
Matt