From: van-bc!cs.ubc.ca!destroyer!caen!uflorida!travis.csd.harris.com!ada1!danr@ ucbvax.Berkeley.EDU (Dan Rittersdorf)
Subject: Re: Does the LRM permit parameter passing by reference?
Date: 9 Oct 92 14:11:46 GMT [thread overview]
Message-ID: <1b43v2INN43n@travis.csd.harris.com> (raw)
In article <1992Oct9.023807.20641@beaver.cs.washington.edu> simonson@cs.washing
ton.edu (Kevin Simonson) writes:
> I was under the impression that Ada made local copies of parameter
>values when a procedure was called. However my Verdix compiler apparently
>does calls by reference when the call is for a string value, as demonstrat-
>ed by the script file below. Notice how the parameter "COPY" (which Ada
>won't allow code to alter inside the procedure) changes its value from the
>first "put_line" to the second.
>
> Is it legal for Ada to allow this parameter to change in the middle of
>the procedure, or have I found a bug?
>
> ---Kevin
Kevin, RM 6.2(7) addresses this issue. For arrays, records, or task types,
the LRM gives the implementation the option of pass by reference or
value. The Verdix compiler and derivatives pass arrays by reference,
and since strings are arrays of character, it is also passed by reference.
Note that for scalar types (integers, enumerations, floating and
fixed point types) the LRM explicitly requires pass by value. You can
count on it for these types.
Note also that any program that depends on the parameter passing
mechanism (for arrays, records, or task types) is declared "erroneous"
by the LRM, which means that the program is in error, but the compiler
is not required to detect this dependence and issue an error message.
--
-danr
______________________________________________________________________________
Dan Rittersdorf danr@travis.ssd.csd.harris.com
Harris Corporation, Computer Systems Division, Fort Lauderdale, FL 33309
______________________________________________________________________________
-Won by One "Sync or be Sunc"
next reply other threads:[~1992-10-09 14:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
1992-10-09 14:11 Dan Rittersdorf [this message]
-- strict thread matches above, loose matches on Subject: below --
1992-10-13 4:16 Does the LRM permit parameter passing by reference? Michael Feldman
1992-10-11 16:20 eru.mt.luth.se!lunic!sunic!nobeltech!dawe
1992-10-09 18:12 Michael Feldman
1992-10-09 2:38 Kevin Simonson
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox