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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no 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-13 06:19:12 PST Path: archiver1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsmm00.sul.t-online.de!t-online.de!news.t-online.com!not-for-mail From: Martin Krischik Newsgroups: comp.lang.ada Subject: Re: Pass by reference Date: Tue, 13 Apr 2004 14:42:46 +0200 Organization: AdaCL Message-ID: <1142490.NlFoPlvMXb@linux1.krischik.com> References: <19b0e504.0404080652.4eab9f80@posting.google.com> <54077117.Uc4Ikxz6le@linux1.krischik.com> <19b0e504.0404090453.3c276b@posting.google.com> Reply-To: krischik@users.sourceforge.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.t-online.com 1081862287 02 24756 +0RTG+WrXoqeJTx 040413 13:18:07 X-Complaints-To: usenet-abuse@t-online.de X-ID: E4JMxiZVwe4xN9xmL0XdzoIrgXPir1txJ6wYM31YFFD1a8Lksafxww User-Agent: KNode/0.7.7 Xref: archiver1.google.com comp.lang.ada:7049 Date: 2004-04-13T14:42:46+02:00 List-Id: Dan McLeran wrote: >> Good Ada compiler will do what is best. So "array (1 .. 2) of Character" >> is likely to be passed by value while "array (1 .. 10_000) of Integer" is >> probably passed by reference. And some Ada compilers might even use pass >> by register. > > Not sure what you mean by 'pass by register'. Maybe each value of a > 2-element array are loaded into registers and then read by the calling > function? Well on a 32bit CPU any data with 'Size <= 32 can be passed by register. But this is purly academic since AFAIK the standart x86 compiler won't do pass by register anyway. >> You say what you need (in, out, in out) and the compiler will choose the >> optimal way to fullfill you which. > > This is what I want to solidify in my brain. Alot of people posting > replies seem to say that the compiler has more freedom than the RM > specifies. If most Ada compilers are conforming, I would assume that > the compiler only has freedom for unspecified types. By-reference and > by-values types must be passed as stated in RM 6.2. True, however there is a reason why By-reference are By-reference. They yould not be anything else - otherwise dispaching would not work. With Regards Martin -- mailto://krischik@users.sourceforge.net http://www.ada.krischik.com