This is the mail archive of the gcc@gcc.gnu.org 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]
Other format: [Raw text]

Re: something that would be nice


On Nov 11, 2003, at 2:49 PM, Matt Wells wrote:

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?

I recommend you take this issue up with the C standards committee. I'd
hate to add this as a local extension to C: local extensions tend to cause
lots of problems, because it's hard to specify all of their corner cases and
all of the ways they interact with existing language features.


(Or, alternatively, you could use some language other than C. ML, C++,
and Python, for example, all make it easy to do what you're looking for.)


--Matt


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