Article View: comp.std.c
Article #3572Re: Wishful thinking: return-parameter
From: Hallvard B Furuseth
Date: Mon, 31 Jul 1995 09:17
Date: Mon, 31 Jul 1995 09:17
27 lines
1172 bytes
1172 bytes
In article <3vhf7k$lo8@mujibur.inmind.com> mfinney@inmind.com writes:
> T aFunction(...) aName
> {
> aName = ...some value...;
> ...
> return;
> ...
> return ...some other value...;
> }
Check out GNU G++, Info node "(gcc)Named Return Values in C++". This:
int foo(int i) return a = i*i
{
if (i < 0)
return i-a;
a++;
}
makes `foo' return the value of `a'. The declaration of `a' is
otherwise a normal declaration. If it doesn't initialize `a', you
shouldn't return before `a' has a value, of course. (`return 0;' is
actually `a = 0; return a;', to get constructors and such stuff right.)
--
Regards,
Hallvard
Technical Details
Message-ID:
<HBF.95Jul31111739@durin.uio.no>Path:
arc1-ca.pugleaf.net!nntp.uio.no!usenetReferences:
<3ver2u$8bk@caip.rutgers.edu> <3vg8l8$5sd@myst.plaza.ds.adp.com> <3vhf7k$lo8@mujibur.inmind.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!nntp.uio.no!usenet From: h.b.furuseth@usit.uio.no (Hallvard B Furuseth) Newsgroups: comp.std.c Subject: Re: Wishful thinking: return-parameter Date: 31 Jul 1995 09:17:39 GMT Organization: University of Oslo, Norway Message-ID: <HBF.95Jul31111739@durin.uio.no> References: <3ver2u$8bk@caip.rutgers.edu> <3vg8l8$5sd@myst.plaza.ds.adp.com> <3vhf7k$lo8@mujibur.inmind.com> NNTP-Posting-Host: durin.uio.no In-reply-to: mfinney@inmind.com's message of 31 Jul 1995 02:30:12 GMT