🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3580

Re: Wishful thinking: return-parameter

#3580
From: mfinney
Date: Mon, 31 Jul 1995 22:12
35 lines
1985 bytes
In <DCL2LC.GBK@proteon.com>, jfw@proteon.com (John Woods) writes:
>mfinney@inmind.com writes:
>>In <3vg8l8$5sd@myst.plaza.ds.adp.com>, whm@news (Bill Morrison) writes:
>>>halasz@caip.rutgers.edu wrote:
>>T aFunction(...) aName
>>   {
>>   aName = ...some value...;
>>   ...
>>   return;
>>   ...
>>   return ...some other value...;
>>   }
>
>Now it's my turn to respectfully disagree.
>
>What a big steaming crock of sh*t.  (whoops, there goes "respectfully")
>
>Just WHAT does this add to the C language that is of value?  Hint:  looking
>like FORTRAN or PASCAL are *not* of value.

I have encountered this lack as a serious problem in generated code where I
had no way to know the return type, but needed a variable (to be used for
storing the return value) of that type.  Further, it quite possibly can allow the
compiler to generate more efficient code when returning large (non-register
size) objects.  Normally those objects are allocated storage in the calling
routine and then passed to the function in question via a "hidden" parameter.
Without explicitly naming the return value, it can be more difficult or impossible
for the compiler to perform the construction of the return value "in place".
That failure can lead to much less efficient code.  Therefore, I believe that
such an extension is very much in the "spirit" of C (and C++ for that matter)
and NOT a way of grafting FORTRAN into C.

And, you might be just a bit more polite.

Michael Lee Finney
Technical Details
Message-ID: <3vjkgi$k65@mujibur.inmind.com>
Path: arc1-ca.pugleaf.net!mujibur.inmind.com!usenet
References: <3ver2u$8bk@caip.rutgers.edu> <3vg8l8$5sd@myst.plaza.ds.adp.com> <3vhf7k$lo8@mujibur.inmind.com> <DCL2LC.GBK@proteon.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!mujibur.inmind.com!usenet
From: mfinney@inmind.com
Newsgroups: comp.std.c
Subject: Re: Wishful thinking: return-parameter
Date: 31 Jul 1995 22:12:34 GMT
Organization: In Mind, Inc.
Message-ID: <3vjkgi$k65@mujibur.inmind.com>
References: <3ver2u$8bk@caip.rutgers.edu> <3vg8l8$5sd@myst.plaza.ds.adp.com> <3vhf7k$lo8@mujibur.inmind.com> <DCL2LC.GBK@proteon.com>
Reply-To: mfinney@inmind.com
NNTP-Posting-Host: finneyman.inmind.com
X-Newsreader: IBM NewsReader/2 v1.2