comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Question about out parameters of unconstrained array type.
Date: Sun, 26 Feb 2012 10:32:22 -0700
Date: 2012-02-26T10:32:22-07:00	[thread overview]
Message-ID: <jidqb6$2mv$1@adenine.netfront.net> (raw)
In-Reply-To: <20120226132532.7fb8ec1b@t60>

On 02/26/2012 05:25 AM, Alexander Senier wrote:
>
> Can anybody comment on the legality of using attributes of an out parameter of
> an unconstrained (array) type in Ada? A brief skim through LRM could not
> enlighten me...

ARM-83 6.2 (Formal Parameter Modes) has:

out      The  formal  parameter is a variable  and permits updating of the
           value of the associated actual parameter.

           The value  of  a scalar parameter that is not updated by the call
           is undefined  upon return;  the  same  holds for the  value  of a
           scalar subcomponent,  other  than a  discriminant.   Reading  the
           bounds and discriminants  of the  formal  parameter  and  of  its
           subcomponents is allowed,  but no other reading.

This explicitly allows reading the bounds of a mode-out formal array parameter 
(note that, in Ada 83, you could not read the value of a mode-out parameter, 
even after assigning to it). ARM-95 and later are more formal, and lack such a 
simple statement about reading attributes.

Whether 'Length counts as "bounds" is another matter; 'Length is 'Pos ('Last) - 
'Pos ('First) + 1, so I'd think it does.

-- 
Jeff Carter
"If you think you got a nasty taunting this time,
you ain't heard nothing yet!"
Monty Python and the Holy Grail
23

--- Posted via news://freenews.netfront.net/ - Complaints to news@netfront.net ---



  parent reply	other threads:[~2012-02-26 17:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-25 15:19 Question about out parameters of unconstrained array type Peter C. Chapin
2012-02-25 15:33 ` Dmitry A. Kazakov
2012-02-25 18:20 ` Phil Thornley
2012-02-25 20:01   ` Simon Wright
2012-02-25 22:44     ` Phil Thornley
2012-02-27 13:48       ` Mark Lorenzen
2012-02-27 15:32         ` Phil Thornley
2012-02-25 23:37   ` Alexander Senier
2012-02-26  1:16   ` Peter C. Chapin
2012-02-26  9:14     ` Phil Thornley
2012-02-26 12:25       ` Alexander Senier
2012-02-26 13:20         ` Phil Thornley
2012-02-26 14:25         ` Niklas Holsti
2012-02-26 17:32         ` Jeffrey Carter [this message]
2012-02-26 15:29       ` Peter C. Chapin
replies disabled

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