From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,cf6748b54b098108 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-11-08 06:12:37 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!logbridge.uoregon.edu!newsfeed.direct.ca!look.ca!newsfeed1.earthlink.net!newsfeed.earthlink.net!newsmaster1.prod.itd.earthlink.net!newsread1.prod.itd.earthlink.net.POSTED!not-for-mail Message-ID: <3BEA84A1.464B0D82@earthlink.net> From: "Marc A. Criley" Organization: Quadrus Corporation X-Mailer: Mozilla 4.73 [en] (X11; U; Linux 2.2.14-5.0 i686) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: OUT = IN OUT for pointers ??? References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Thu, 08 Nov 2001 14:12:34 GMT NNTP-Posting-Host: 63.178.185.167 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 1005228754 63.178.185.167 (Thu, 08 Nov 2001 06:12:34 PST) NNTP-Posting-Date: Thu, 08 Nov 2001 06:12:34 PST X-Received-Date: Thu, 08 Nov 2001 06:08:35 PST (newsmaster1.prod.itd.earthlink.net) Xref: archiver1.google.com comp.lang.ada:16061 Date: 2001-11-08T14:12:34+00:00 List-Id: 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