comp.lang.ada
 help / color / mirror / Atom feed
From: dan.r.mcleran@seagate.com (Dan McLeran)
Subject: Re: Pass by reference
Date: 8 Apr 2004 20:24:15 -0700
Date: 2004-04-08T20:24:15-07:00	[thread overview]
Message-ID: <19b0e504.0404081924.5c20c697@posting.google.com> (raw)
In-Reply-To: 82347202.0404081104.33d05af0@posting.google.com

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.



  reply	other threads:[~2004-04-09  3:24 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-08 14:52 Pass by reference Dan McLeran
2004-04-08 18:21 ` Martin Krischik
2004-04-09 12:53   ` Dan McLeran
2004-04-13 12:42     ` Martin Krischik
2004-04-08 19:04 ` Jim Rogers
2004-04-09  3:24   ` Dan McLeran [this message]
2004-04-09  0:01 ` Stephen Leake
2004-04-09 12:38   ` Dan McLeran
2004-04-09 13:03     ` Dmitry A. Kazakov
2004-04-09 19:09       ` Dan McLeran
2004-04-10 10:49         ` Dmitry A. Kazakov
2004-04-11 12:43       ` Florian Weimer
2004-04-12 10:29         ` Dmitry A. Kazakov
2004-04-12 12:29           ` Samuel Tardieu
2004-04-13  8:46             ` Dmitry A. Kazakov
2004-04-10  1:42     ` Stephen Leake
2004-04-10 16:05       ` chris
2004-04-09 12:44   ` Dan McLeran
2004-04-09 22:44     ` Randy Brukardt
2004-04-09 14:44   ` Simon Wright
2004-04-09  1:15 ` Jeffrey Carter
2004-04-09  1:28   ` Pat Rogers
2004-04-10  1:05     ` Jeffrey Carter
2004-04-09 12:57   ` Dan McLeran
2004-04-10  1:16     ` Jeffrey Carter
2004-04-09  4:03 ` Steve
2004-04-09 14:50   ` Simon Wright
2004-04-09 17:12     ` Pat Rogers
2004-04-09 19:33       ` Vinzent 'Gadget' Hoefler
2004-04-10  6:33         ` Simon Wright
2004-04-13 10:26           ` Vinzent 'Gadget' Hoefler
2004-04-14 17:27             ` Simon Wright
2004-04-15  9:43               ` Vinzent 'Gadget' Hoefler
2004-04-17  7:59                 ` Simon Wright
2004-04-11 12:45   ` Florian Weimer
replies disabled

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