comp.lang.ada
 help / color / mirror / Atom feed
From: "Marius Amado Alves" <amado.alves@netcabo.pt>
To: <comp.lang.ada@ada-france.org>
Subject: Re: Where are returned values stored?
Date: Thu, 27 May 2004 10:39:39 +0100
Date: 2004-05-27T10:39:39+01:00	[thread overview]
Message-ID: <mailman.10.1085650792.391.comp.lang.ada@ada-france.org> (raw)
In-Reply-To: 75s9b0pgo91ctvlm5op2rcql82t9ip4me2@4ax.com

>  It has a declarative part in the middle of the code, in which a
> variable (Result)  is declared.  The stuff in that variable is
> returned.

This is a common idiom. In many languages. Don't think in machine terms,
think in language terms. *Values* are being passed around, not objects. You
are already thinking value (stuff in that variable), so that's good. When
you call the function, you provide a place, usually a variable, to hold the
value.

   Object := Function_Call;

So no worries. The value might have travelled to Japan and back, but that's
the machine business, not the programmer's. Now it's held in your Object,
and that's all you need. This from a function user standpoint. From a
function writer standpoint, well, think value again. When you write

   return Result;

you're passing the value. Under the language contract, the user we'll catch
it. (In Ada he has to catch it, in C he can drop it on the spot.)




  parent reply	other threads:[~2004-05-27  9:39 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-26 19:46 Where are returned values stored? (follow up to yesterday's question) James Alan Farrell
2004-05-26 20:44 ` Simon Wright
2004-05-27  7:51   ` Dmitry A. Kazakov
2004-05-27  9:39 ` Marius Amado Alves [this message]
2004-05-27 17:05   ` Where are returned values stored? Warren W. Gay VE3WWG
2004-05-27 20:24     ` James Alan Farrell
2004-05-28 20:33       ` Warren W. Gay VE3WWG
2004-05-29  7:03         ` Martin Krischik
2004-05-29 13:19           ` Larry Kilgallen
2004-05-30  7:10             ` Martin Krischik
2004-06-02  3:14         ` Robert I. Eachus
2004-05-30 21:17     ` Nick Roberts
2004-05-31 12:58       ` Warren W. Gay VE3WWG
2004-06-02  4:07         ` Robert I. Eachus
2004-06-02 12:42           ` Warren W. Gay VE3WWG
2004-06-03  2:00             ` Nick Roberts
2004-06-03  4:34             ` Robert I. Eachus
2004-06-03 16:06               ` Warren W. Gay VE3WWG
2004-06-03 16:13               ` Nick Roberts
2004-06-07  1:53                 ` Robert I. Eachus
2004-06-07 13:09                   ` Larry Kilgallen
2004-06-09  7:03                     ` Robert I. Eachus
2004-06-05 17:13             ` Simon Wright
2004-05-27 17:11   ` Martin Krischik
2004-05-27 17:07 ` Where are returned values stored? (follow up to yesterday's question) Martin Krischik
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox