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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,9f3d09bde7b33b5d X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-04-08 20:24:16 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: dan.r.mcleran@seagate.com (Dan McLeran) Newsgroups: comp.lang.ada Subject: Re: Pass by reference Date: 8 Apr 2004 20:24:15 -0700 Organization: http://groups.google.com Message-ID: <19b0e504.0404081924.5c20c697@posting.google.com> References: <19b0e504.0404080652.4eab9f80@posting.google.com> <82347202.0404081104.33d05af0@posting.google.com> NNTP-Posting-Host: 198.81.26.44 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1081481055 5275 127.0.0.1 (9 Apr 2004 03:24:15 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 9 Apr 2004 03:24:15 +0000 (UTC) Xref: archiver1.google.com comp.lang.ada:6877 Date: 2004-04-08T20:24:15-07:00 List-Id: Jim, Thanks for the response. I am quite new to Ada and am trying to get my head around all of the details. You wrote: >Ada provides some guidance to the compiler, but the general idea >is that the compiler is free to choose the most efficient parameter >passing mechanism for each instance. The Language RM reads more strictly than that. When I read section 6.2: "A type is a by-copy type if it is an elementary type, or if it is a descendant of a private type whose full type is a by-copy type. A parameter of a by-copy type is passed by copy." The RM also states: "A parameter of a by-reference type is passed by reference." No ambiguity is implied here. I assume that a conforming compiler does not get to decide which way to go. Anyone else care to comment? There is one statement that leads me to believe that the answer to the by-copy or by-reference question may be ambiguous. The RM states: "For parameters of other types, it is unspecified whether the parameter is passed by copy or by reference. " It seems that an array of elementary types does not fit in with either the by-copy types or by-reference types. In this case, it seems to be up to the compiler implementation.