From: "James A. Squire" <m193884@CSEHP3.MDC.COM>
Subject: Re: Uninitialized "out" parameters
Date: 1996/07/19
Date: 1996-07-19T00:00:00+00:00 [thread overview]
Message-ID: <31EF9DFC.6FB4@csehp3.mdc.com> (raw)
In-Reply-To: 4smmhe$9cs@goanna.cs.rmit.edu.au
Adam Beneschan wrote:
>
> Dale Stanbrough <dale@goanna.cs.rmit.edu.au> writes:
>
> >Adam Beneschan writes:
> >"Well, you can't read an "out" parameter at all, so it's illegal to use
> > "op" in the right-hand side of your assignment. So the compiler
> > should give you an error. Also, in Ada83, you'll get an error because
> > I needs to be declared before the code for SubP appears.
> >
> > If you change op to an "in out" parameter, you'll be reading an
> > uninitialized variable, but typically neither the compiler nor the
> > runtime will complain."
> >
> >
> >Ada95 does allow you to read out parameters. The code written simply
> >uses an uninitialized variable, and I would imagine it would be declared
> >erroneous by the LRM.
>
> Sorry, I wasn't aware of this change.
>
> This rule change frightens me a little. In the posted example:
>
> procedure SubP (op : out integer) is
> begin
> op := op + 1;
> end SubP;
>
> I've been known to accidentally type "out" when I mean "in out". In
> Ada 83, the compiler would catch me, but now it won't, and the effect
> will be very different because here the "op" on the right side of the
> assignment is always uninitialized. However, I guess a smart compiler
> would let me know that I'm using an uninitialized parameter, and
> perhaps the advantages of letting you read an OUT parameter after
> you've written to it outweigh this disadvantage.
I tried to find out from the LRM if this compiler behavior is required,
but I don't see it anywher in chapter 6. I do know that in 6.1.1 of the
Ada95 Rationale, it has the following paragraph:
"For Ada 95, we have removed the restrictions on the use of out
parameters. Specifying that a formal parameter is of mode out indicates
that the caller need not initialize it prior to the call. However,
within the procedure, once the
^^^^^^^^
parameter has been initialized, it may be read and updated like any
other
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
variable. As with a normal variable, it is an error to depend on the
value of an out parameter prior to its being initialized."
but I don't know if that's a compiler error or a run-time error. From
the context, I'd guess a run-time error.
--
James Squire mailto:ja_squire@csehp3.mdc.com
MDA Avionics Tools & Processes
McDonnell Douglas Aerospace http://www.mdc.com/
Opinions expressed here are my own and NOT my company's
"Nice shark...pretty shark..."
-- Londo, "The Gathering"
next prev parent reply other threads:[~1996-07-19 0:00 UTC|newest]
Thread overview: 104+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-07-18 0:00 Uninitialized "out" parameters Paul Whittington
1996-07-18 0:00 ` Adam Beneschan
1996-07-18 0:00 ` Robert Dewar
1996-07-19 0:00 ` Pascal Obry
1996-07-19 0:00 ` Peter Hermann
1996-07-19 0:00 ` Dale Stanbrough
1996-07-19 0:00 ` Adam Beneschan
1996-07-19 0:00 ` James A. Squire [this message]
1996-07-19 0:00 ` Adam Beneschan
1996-07-20 0:00 ` Michael Feldman
1996-07-21 0:00 ` Fergus Henderson
1996-07-21 0:00 ` Michael Feldman
1996-07-21 0:00 ` Robert Dewar
1996-07-22 0:00 ` Fergus Henderson
1996-07-23 0:00 ` Michael Feldman
1996-07-23 0:00 ` Robert Dewar
1996-07-25 0:00 ` Fergus Henderson
1996-07-24 0:00 ` Fergus Henderson
1996-07-24 0:00 ` Robert A Duff
1996-07-25 0:00 ` Richard A. O'Keefe
1996-07-19 0:00 ` Samuel Tardieu
1996-07-19 0:00 ` John Herro
1996-07-19 0:00 ` Tucker Taft
1996-07-23 0:00 ` Peter Hermann
1996-07-23 0:00 ` Robert A Duff
1996-07-18 0:00 ` Robert Dewar
1996-07-19 0:00 ` Peter Amey
1996-07-20 0:00 ` Fergus Henderson
1996-07-20 0:00 ` Robert Dewar
1996-07-21 0:00 ` Fergus Henderson
1996-07-21 0:00 ` Robert Dewar
1996-07-23 0:00 ` Richard A. O'Keefe
1996-07-23 0:00 ` Robert A Duff
1996-07-24 0:00 ` Richard A. O'Keefe
1996-07-24 0:00 ` Robert A Duff
1996-07-25 0:00 ` Richard A. O'Keefe
1996-07-25 0:00 ` Robert A Duff
1996-07-24 0:00 ` Theodore E. Dennison
1996-07-25 0:00 ` Frank Manning
1996-07-25 0:00 ` Richard A. O'Keefe
1996-07-26 0:00 ` Frank Manning
1996-07-23 0:00 ` Robert Dewar
1996-07-24 0:00 ` Fergus Henderson
1996-07-24 0:00 ` Robert A Duff
1996-07-24 0:00 ` Fergus Henderson
1996-07-25 0:00 ` Richard A. O'Keefe
1996-07-25 0:00 ` Robert A Duff
1996-07-23 0:00 ` Fergus Henderson
1996-07-23 0:00 ` Robert A Duff
1996-07-24 0:00 ` Fergus Henderson
1996-07-24 0:00 ` Fergus Henderson
1996-07-19 0:00 ` Michel Gauthier
1996-07-21 0:00 ` Robert A Duff
1996-07-19 0:00 ` Peter Amey
1996-07-21 0:00 ` Robert A Duff
1996-07-22 0:00 ` Is 'out' different from 'in out' (Was: Uninitialized "out" parameters) Michel Gauthier
1996-07-22 0:00 ` Tucker Taft
1996-07-22 0:00 ` Robert A Duff
1996-07-22 0:00 ` Robert Dewar
1996-07-23 0:00 ` Michel Gauthier
1996-07-23 0:00 ` Robert Dewar
1996-07-24 0:00 ` Pascal Obry
1996-07-25 0:00 ` Tucker Taft
1996-07-23 0:00 ` Uninitialized "out" parameters John Herro
1996-07-23 0:00 ` Robert Dewar
1996-07-24 0:00 ` Peter Hermann
1996-07-23 0:00 ` Robert A Duff
1996-07-24 0:00 ` Uninitialized variables, Java example Arra Avakian
1996-07-25 0:00 ` Robert A Duff
1996-07-25 0:00 ` Richard A. O'Keefe
1996-07-25 0:00 ` Robert A Duff
1996-07-26 0:00 ` Uninitialized "out" parameters Stephen J Bevan
1996-07-26 0:00 ` Robert A Duff
1996-07-24 0:00 ` Uninitialized variables, Java example Felaco
-- strict thread matches above, loose matches on Subject: below --
1996-07-29 0:00 Uninitialized out parameters W. Wesley Groleau (Wes)
2016-04-05 12:02 ahlan
2016-04-05 13:17 ` rieachus
2016-04-05 14:07 ` ahlan
2016-04-06 9:45 ` Mark Lorenzen
2016-04-06 21:01 ` Jeffrey R. Carter
2016-04-07 7:10 ` ahlan
2016-04-05 16:19 ` G.B.
2016-04-06 8:19 ` ahlan
2016-04-06 10:17 ` G.B.
2016-04-06 11:44 ` Dennis Lee Bieber
2016-04-06 20:41 ` Niklas Holsti
2016-04-06 20:54 ` Randy Brukardt
2016-04-06 20:47 ` Randy Brukardt
2016-04-06 21:01 ` Randy Brukardt
2016-04-06 21:22 ` Dmitry A. Kazakov
2016-04-07 7:27 ` Randy Brukardt
2016-04-06 11:37 ` AdaMagica
2016-04-06 13:44 ` ahlan
2016-04-06 14:09 ` Mark Lorenzen
2016-04-06 14:10 ` G.B.
2016-04-06 20:53 ` Stefan.Lucks
2016-04-06 21:03 ` Randy Brukardt
2016-04-06 21:12 ` Niklas Holsti
2016-04-06 21:30 ` Randy Brukardt
2016-04-07 9:56 ` Stefan.Lucks
2016-04-07 16:08 ` AdaMagica
2016-04-07 23:02 ` Randy Brukardt
2016-04-08 7:32 ` Dmitry A. Kazakov
2016-04-07 7:52 ` Georg Bauhaus
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox