From: "Peter C. Chapin" <PChapin@vtc.vsc.edu>
Subject: Question about out parameters of unconstrained array type.
Date: Sat, 25 Feb 2012 10:19:02 -0500
Date: 2012-02-25T10:19:02-05:00 [thread overview]
Message-ID: <I8qdndMrnK9zZtXS4p2dnAA@giganews.com> (raw)
Consider a simple procedure
procedure P(S : out String) is
begin
...
end P;
Despite the fact that S behaves as if it is uninitialized my Ada
compiler (GNAT GPL 2011) allows me to read certain attributes. For
example if the body is
for I in 1 .. S'Length loop ...
(never mind that I'm making a bad assumption about S'First being 1) I
don't see any warning about reading an uninitialized value when I do
S'Length. This is fine but I'm having trouble locating in the LRM where
this behavior is explicitly said to be well defined. Is it well defined?
Where does it say so?
The reason I'm asking is because SPARK does *not* like the usage of
S'Length in my example above. I either have to 1) give the parameter
mode in out or 2) initialize S inside the procedure before doing
anything with it (for example with an aggregate). SPARK appears to
behave as if the entire string is uninitialized upon entry into the
procedure... even the attributes. I'm having trouble finding information
about this in my SPARK references also.
Peter
next reply other threads:[~2012-02-25 15:19 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-25 15:19 Peter C. Chapin [this message]
2012-02-25 15:33 ` Question about out parameters of unconstrained array type 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
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