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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7be1cfc685fd1ce2 X-Google-Attributes: gid103376,public From: Tucker Taft Subject: Re: Access types vs. Record types as procedure parameters Date: 1999/08/19 Message-ID: <37BC71FD.61FA864E@averstar.com>#1/1 X-Deja-AN: 514840658 Content-Transfer-Encoding: 7bit Sender: news@inmet.camb.inmet.com (USENET news) X-Nntp-Posting-Host: houdini.burl.averstar.com References: <37BC4F12.E33D50EE@gbr.msd.ray.com> <37bc69fe@news1.us.ibm.net> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: AverStar (formerly Intermetrics) Burlington, MA USA Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 1999-08-19T00:00:00+00:00 List-Id: Matthew Heaney wrote: > > In article <37BC4F12.E33D50EE@gbr.msd.ray.com> , Andrew L Moore {66003} > wrote: > > > I am debating on whether to pass a record object to a procedure or an > > access type to that record object. > ... > Do it this way, because the record type is *probably* being passed by > reference anyway. > > If you want to guarantee that the record object is passed by reference, then > declare it as tagged or limited: ... If efficiency is your goal, there is no need to force the issue. The compiler should pass by copy when that is more efficient (e.g. when the record is very small), and pass by reference otherwise. It sounds like you have been lulled into looking at the world from a "C" perspective, where structs are either passed by copy, or you need to explicitly pass a pointer. In Ada, records are almost always passed by reference, even when they are "IN" parameters. The only time they would be passed by copy is if they are very small or bit-aligned. > -- > Matt > > It is impossible to feel great confidence in a negative theory which has > always rested its main support on the weak points of its opponent. > > Joseph Needham, "A Mechanistic Criticism of Vitalism" -- -Tucker Taft stt@averstar.com http://www.averstar.com/~stt/ Technical Director, Distributed IT Solutions (www.averstar.com/tools) AverStar (formerly Intermetrics, Inc.) Burlington, MA USA