comp.lang.ada
 help / color / mirror / Atom feed
From: Tucker Taft <stt@averstar.com>
Subject: Re: Access types vs. Record types as procedure parameters
Date: 1999/08/19
Date: 1999-08-19T00:00:00+00:00	[thread overview]
Message-ID: <37BC71FD.61FA864E@averstar.com> (raw)
In-Reply-To: 37bc69fe@news1.us.ibm.net

Matthew Heaney wrote:
> 
> In article <37BC4F12.E33D50EE@gbr.msd.ray.com> , Andrew L Moore {66003}
> <alm@gbr.msd.ray.com>  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




  reply	other threads:[~1999-08-19  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-08-19  0:00 Access types vs. Record types as procedure parameters Andrew L Moore {66003}
1999-08-19  0:00 ` Matthew Heaney
1999-08-19  0:00   ` Tucker Taft [this message]
1999-08-19  0:00 ` Robert Dewar
1999-08-19  0:00 ` Larry Kilgallen
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox