🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3638

Re: Mutiple Returns

#3638
From: Stephen Baynes
Date: Thu, 03 Aug 1995 12:18
61 lines
1375 bytes
Jim Fleming (jim.fleming@bytes.com) wrote:

: Has anyone looked into adding multiple return values to the ANSI C
: standard...???

: main()
: {
: 	int i,j;

: 	(i,j) = f(4);
: }

: (a,b) f (z)
: 	float a;
: 	int b;
: 	int z;
: {
: 	a = 3.14159;
: 	b = 0x5050;
: }

: Note...with this you get also get to return values via simple assignments.

Alternative syntax is to present these as out parameters. Here are two ideas:

Eg[1]:
void f (z) out (a,b) 
	float a;
	int b;
	int z;
{
	a = 3.14159;
	b = 0x5050;
}
main()
{
	int i,j;
	f(4) out (i,j);
}


Eg[2]:
void f (z, out a, out b) 
	float a;
	int b;
	int z;
{
	a = 3.14159;
	b = 0x5050;
}
main()
{
	int i,j;
	f(4, i, j);
}

--
Stephen Baynes                              baynes@mulsoc2.serigate.philips.nl
Philips Semiconductors Ltd
Southampton                                 My views are my own.
United Kingdom
Technical Details
Message-ID: <DCqI74.G7E@ukpsshp1.serigate.philips.nl>
Path: arc1-ca.pugleaf.net!phcoms4.seri.philips.nl!panther!baynes
References: <3vpf4f$nl6@News1.mcs.net>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!phcoms4.seri.philips.nl!panther!baynes
From: baynes@ukpsshp1.serigate.philips.nl (Stephen Baynes)
Subject: Re: Mutiple Returns
Sender: news@ukpsshp1.serigate.philips.nl (account for localnews)
Message-ID: <DCqI74.G7E@ukpsshp1.serigate.philips.nl>
Date: Thu, 3 Aug 1995 12:18:40 GMT
References: <3vpf4f$nl6@News1.mcs.net>
Organization: Philips Semiconductors, Southampton, UK
X-Newsreader: TIN [version 1.2 PL2]