🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3575

Re: Wishful thinking: return-parameter

#3575
From: John Woods
Date: Mon, 31 Jul 1995 13:53
55 lines
2454 bytes
mfinney@inmind.com writes:
>In <3vg8l8$5sd@myst.plaza.ds.adp.com>, whm@news (Bill Morrison) writes:
>>halasz@caip.rutgers.edu wrote:
>>: What with all this stuff propozed for new standard C, one thing I want
>>: to see, the return-parameter.  A function is declared with a set of
>>: parameters meant to forward to it arugments passd in calling it.  The
>>: declaration for returning looks quite different, and there is no real
>>: need for "return" to return anithing.  Indeed, it were better if it not.
>>: Here I make up quite arbitrarie syntax:
>>: 	int q(char k) l
>>: 	{	....
>>: 		l = 3;
>>: 		....
>>: 	}
>I have long believed that the basic idea is good, but you don't want to 
>eliminate the return statement either.  I would suggest that a function
>with a return type...
>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.

You can perform work after calculating the final return value trivially
with the existing mechanism:

T aFunction( ... )
{
	T aName;

	aName = somevalue;
	/* do stuff */
	return aName;
}

and better yet, everything is spelled out in black and white.  (Or black
and green, depending on your terminal.)  The *only* conceivable advantage
of the proposed mechanism is to save a trivial amount of typing (as in
keyboard, not "type mechanism"), and it is much less subject to confusion.

I suppose it might also save one word of storage on ridiculous dinosaur
machines designed for FORTRAN with a return parameter word located before
the function's instructions.  Instead of perverting the C language to prop
these things up, send 'em to the scrapheap and get something modern with
REAL power, like an 8008 processor.
Technical Details
Message-ID: <DCL2LC.GBK@proteon.com>
Path: arc1-ca.pugleaf.net!monk.proteon.com!jfw
References: <3ver2u$8bk@caip.rutgers.edu> <3vg8l8$5sd@myst.plaza.ds.adp.com> <3vhf7k$lo8@mujibur.inmind.com>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!monk.proteon.com!jfw
From: jfw@proteon.com (John Woods)
Subject: Re: Wishful thinking: return-parameter
Message-ID: <DCL2LC.GBK@proteon.com>
Sender: news@proteon.com
Nntp-Posting-Host: kerplop.proteon.com
Organization: Proteon, Inc., Westborough, Ma.
References: <3ver2u$8bk@caip.rutgers.edu> <3vg8l8$5sd@myst.plaza.ds.adp.com> <3vhf7k$lo8@mujibur.inmind.com>
Date: Mon, 31 Jul 1995 13:53:35 GMT