comp.lang.ada
 help / color / mirror / Atom feed
From: "Marc A. Criley" <mcqada@earthlink.net>
Subject: Re: OUT = IN OUT for pointers ???
Date: Thu, 08 Nov 2001 14:12:34 GMT
Date: 2001-11-08T14:12:34+00:00	[thread overview]
Message-ID: <3BEA84A1.464B0D82@earthlink.net> (raw)
In-Reply-To: tu_F7.18828$9_6.1941808@news20.bellglobal.com

Pi wrote:
> 
> I came across some code where a pointer was passed in mode OUT.
> If the pointer would be null initially, the code wouldn't work.
> 
> But it does work.
> 
> With a debugger I verified :
> Even as the pointer is in mode OUT,
> it's value is passed as if it was IN OUT.
> 
> I use GNAT, but Aonix seams to have the same behavior too.
> 
> Now, my question :
> Must it be like that and is defined that way in the ARM ?
> or it is an option that it left to the choice of the implementation ?
> or is it a bug ?

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.

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.

Note, though, that some kinds of information can be legally extracted
from certain kinds of types of arguments passed as out paramters, e.g.,
the bounds of an array, the value of a record discriminant.

Marc A. Criley
Senior Staff Engineer
Quadrus Corporation
www.quadruscorp.com



  reply	other threads:[~2001-11-08 14:12 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 [this message]
2001-11-08 17:46   ` Jeffrey Carter
replies disabled

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