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-09 15:44:32 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!sn-xit-03!sn-xit-01!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Pass by reference Date: Fri, 9 Apr 2004 17:44:06 -0500 Organization: Posted via Supernews, http://www.supernews.com Message-ID: <107e9q6d28rv8a@corp.supernews.com> References: <19b0e504.0404080652.4eab9f80@posting.google.com> <19b0e504.0404090444.376ab672@posting.google.com> X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 X-Complaints-To: abuse@supernews.com Xref: archiver1.google.com comp.lang.ada:6927 Date: 2004-04-09T17:44:06-05:00 List-Id: "Dan McLeran" wrote in message news:19b0e504.0404090444.376ab672@posting.google.com... > > The compiler is always free to choose either copy or reference for > > passing parameters. > > This statement seems to contradict the RM and what you've said above. > The way I read the RM, a by-reference type is passed by reference. No > choice. A by-value type is passed by value. Again, no choice. The RM > seems to indicate that the only time a compiler is free to choose is > for the 'unspecified' types. That's not quite true. The important thing is that the passing has the semantics of by-reference or by-copy, not necessarily that that is used. For instance, we've worked on targets where the standard calling convention did not support copy back. In order to implement 'in out' parameters of elementary types on those targets, we do the parameter passing by-reference, and make a copy at the call-site to insure the by-copy semantics. (We also use a similar trick for passing large [>32 bit] elementary objects.) Randy.