From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,984d3d7860d7c8c X-Google-Attributes: gid103376,public Path: controlnews3.google.com!news1.google.com!news.glorb.com!fr.ip.ndsoftware.net!proxad.net!usenet-fr.net!enst.fr!melchior!cuivre.fr.eu.org!melchior.frmug.org!not-for-mail From: "Marius Amado Alves" Newsgroups: comp.lang.ada Subject: Re: Where are returned values stored? Date: Thu, 27 May 2004 10:39:39 +0100 Organization: Cuivre, Argent, Or Message-ID: References: <75s9b0pgo91ctvlm5op2rcql82t9ip4me2@4ax.com> NNTP-Posting-Host: lovelace.ada-france.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: melchior.cuivre.fr.eu.org 1085650792 4024 212.85.156.195 (27 May 2004 09:39:52 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Thu, 27 May 2004 09:39:52 +0000 (UTC) To: Return-Path: X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-OriginalArrivalTime: 27 May 2004 09:39:38.0046 (UTC) FILETIME=[86FFEDE0:01C443CE] X-Virus-Scanned: by amavisd-new-20030616-p7 (Debian) at ada-france.org X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Gateway to the comp.lang.ada Usenet newsgroup" List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: controlnews3.google.com comp.lang.ada:875 Date: 2004-05-27T10:39:39+01:00 > 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.)