From: Dmitry A. Kazakov <mailbox@dmitry-kazakov.de>
Subject: Re: Out parameters in a function
Date: Wed, 17 Apr 2002 09:57:26 +0200
Date: 2002-04-17T09:57:26+02:00 [thread overview]
Message-ID: <ep8qbu4n4ubb511n95k6ohpdl9popsj3m1@4ax.com> (raw)
In-Reply-To: fb0dad84b83cb3f18e62a52db60c8764.48257@mygate.mailgate.org
On Tue, 16 Apr 2002 20:00:42 +0000 (UTC), "Kent Paul Dolan"
<xanthian@well.com> wrote:
>"John McCabe" <john.mccabe@emrad.ns.com> wrote:
>
> > type of thing, but I can't remember off-hand how you would use a
> > returned status with multiple return values!
>
>Well, if I'm not inventing capabilities, in C the syntax is fairly
>direct (and forgive that with several dozen languages mixed in my head I
>cannot write any one correctly without manual in lap, which I don't have
>these days):
>
>if
>(
> (
> aSomestructTypedVariable =
> aSomestructReturningFunction
> (
> lots,
> of,
> parms
> )
> ).booleanPart
>)
>{
> usefulVal = aSomestructTypedVariable.usefulPart;
>}
Same in Ada:
declare
aSomestructTypedVariable : constant SomestructType :=
aSomestructReturningFunction (...);
begin
if aSomestructTypedVariable.booleanPart then
usefulVal := aSomestructTypedVariable.usefulPart;
end if;
end;
Not a big deal.
A real advantage [and possible the single one] of returned tuples of
values is when you are able to use them as a part of the parameter
list for some other subroutine. There are things that cannot be done
with temp variables + out parameters. For instance
Text :String := Get_Nobody_Knows_How_Many_Characters (...);
cannot be replaced with:
Text : String; -- Error!
begin
Get_Nobody_Knows_How_Many_Characters (..., Text);
---
Regards,
Dmitry Kazakov
www.dmitry-kazakov.de
next prev parent reply other threads:[~2002-04-17 7:57 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-04-14 18:29 Out parameters in a function Nazgul
2002-04-14 19:45 ` David C. Hoos, Sr.
2002-04-15 10:49 ` John McCabe
2002-04-15 11:51 ` John McCabe
2002-04-15 13:43 ` Steve Doiel
2002-04-15 15:09 ` Ted Dennison
2002-04-16 8:49 ` John McCabe
2002-04-16 10:05 ` Dmitry A. Kazakov
2002-04-16 15:26 ` John McCabe
2002-04-16 19:34 ` Matthew Woodcraft
2002-04-16 20:10 ` Darren New
2002-04-17 1:30 ` Kent Paul Dolan
2002-04-17 16:15 ` Darren New
2002-04-19 17:39 ` Florian Weimer
2002-04-17 13:24 ` Stephen Leake
2002-04-17 16:32 ` Darren New
2002-04-17 21:03 ` Kent Paul Dolan
2002-04-18 12:14 ` Wolfgang Gellerich
2002-04-18 13:52 ` Dmitry A. Kazakov
2002-04-18 16:28 ` Darren New
2002-04-17 10:17 ` John McCabe
2002-04-16 19:58 ` Kent Paul Dolan
2002-04-16 20:00 ` Kent Paul Dolan
2002-04-17 4:40 ` Jim Rogers
2002-04-17 5:27 ` Kent Paul Dolan
2002-04-17 5:50 ` Eric G. Miller
2002-04-24 2:45 ` David Thompson
2002-04-19 17:40 ` Florian Weimer
2002-04-19 18:26 ` Jim Rogers
2002-04-19 18:53 ` Florian Weimer
2002-04-17 7:57 ` Dmitry A. Kazakov [this message]
2002-04-17 10:21 ` John McCabe
2002-04-24 17:21 ` Warren W. Gay VE3WWG
2002-04-26 7:32 ` Dmitry A. Kazakov
2002-04-15 16:24 ` Stephen Leake
2002-04-16 13:38 ` Ted Dennison
2002-04-17 11:55 ` Ingo Marks
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox