Article View: comp.std.c
Article #3604Re: Wishful thinking: return-parameter
From: Christopher R. Volpe
Date: Wed, 02 Aug 1995 00:36
Date: Wed, 02 Aug 1995 00:36
38 lines
2132 bytes
2132 bytes
In article <3ver2u$8bk@caip.rutgers.edu>, halasz@caip.rutgers.edu writes:
>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;
> ....
> }
>
>When "q" is through, the function returns the valu stord in "l".
>
>Fortran and Pascal s mistake was to name the return-parameter the same
>as the function, the basic idea is good. This means that we can free
>us of the "goto"ish "return".
What's the point? What does your proposal provide that can't be achieved by
simply appending "return l;" to the body of the function? What's the
justification for your comment "Indeed, it were better if it not"?
What "goto-ish return" are you talking about? If you dislike the practice of
having multiple return statements in your functions, just use a regular goto
to the end of the function. Any situation where this is necessary, it would
also be necessary under your scheme. Personally, I like the ability to
indicate to the person reading the code that we're exiting immediately from
the function right here, rather than making him search for a goto-label, or
adding obfuscating levels of conditional execution.
--
Chris Volpe Phone: (518) 387-7766 (Dial Comm 8*833
GE Corporate R&D Fax: (518) 387-6560
PO Box 8, Schenectady, NY 12301 Email: volpecr@crd.ge.com
Technical Details
Message-ID:
<DCnr0G.BD1@crdnns.crd.ge.com>Path:
arc1-ca.pugleaf.net!bart.crd.ge.com!volpeReferences:
<3ver2u$8bk@caip.rutgers.edu>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c Path: arc1-ca.pugleaf.net!bart.crd.ge.com!volpe From: volpe@bart.crd.ge.com (Christopher R. Volpe) Subject: Re: Wishful thinking: return-parameter Message-ID: <DCnr0G.BD1@crdnns.crd.ge.com> Sender: volpe@bart (Christopher R. Volpe) Nntp-Posting-Host: bart.crd.ge.com Reply-To: volpe@ausable.crd.ge.com Organization: GE Corporate Research & Development References: <3ver2u$8bk@caip.rutgers.edu> Date: Wed, 2 Aug 1995 00:36:16 GMT