comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <jeffrey.carter@boeing.com>
Subject: Re: OUT = IN OUT for pointers ???
Date: Thu, 8 Nov 2001 17:46:55 GMT
Date: 2001-11-08T17:46:55+00:00	[thread overview]
Message-ID: <3BEAC50F.5359DDB5@boeing.com> (raw)
In-Reply-To: 3BEA84A1.464B0D82@earthlink.net

"Marc A. Criley" wrote:
> 
> It kinda depends on the code where this is occurring.  Generally, an
> 'out' mode parameter is to be treated as an uninitialized local
> variable, meaning that it could contain any sequence of bits--which may
> or may not designate a valid value.

There are important exceptions to this, see ARM 6.4.1.

Of interest to this question, 6.4.1(7) says

"For an out parameter that is passed by copy ...: For an access type,
the formal parameter is initialized from the value of the actual,
without a constraint check"

For pass-by-reference types, types with discriminants, and types with
implicit initial values, there is no difference between mode out and
mode in out. Mode out can be relied on to be significantly different
from mode in out only for numeric and enumeration types.

> 
> Since a compiler will commonly pass an out parameter as (in effect) the
> address of the argument, an initial value possessed by that argument may
> be unintentionally made available to the subprogram body.  Depending on
> and using such a value, however, is erroneous.

However, elementary types, which include access types, are always passed
by copy.

-- 
Jeffrey Carter



      reply	other threads:[~2001-11-08 17:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-06 23:58 OUT = IN OUT for pointers ??? Pi
2001-11-08 14:12 ` Marc A. Criley
2001-11-08 17:46   ` Jeffrey Carter [this message]
replies disabled

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