comp.lang.ada
 help / color / mirror / Atom feed
* Uninitialized "out" parameters
@ 1996-07-18  0:00 Paul Whittington
  1996-07-18  0:00 ` Adam Beneschan
                   ` (8 more replies)
  0 siblings, 9 replies; 104+ messages in thread
From: Paul Whittington @ 1996-07-18  0:00 UTC (permalink / raw)



In the following Ada program, should either the compiler or the run-time
get some kind of error because the out parameter is not initialized?

procedure Testit is

  procedure SubP (op : out Integer) is
  begin
    op := op+1;
  end SubP;

  I : Integer;

begin
  SubP (I);
end Testit;




^ permalink raw reply	[flat|nested] 104+ messages in thread
* Re: Uninitialized out parameters
@ 1996-07-29  0:00 W. Wesley Groleau (Wes)
  0 siblings, 0 replies; 104+ messages in thread
From: W. Wesley Groleau (Wes) @ 1996-07-29  0:00 UTC (permalink / raw)



Bob Duff pointed out that in Ada, OFTEN the compiler cannot tell whether
a variable has been initialized and suggested that giving warnings in
these cases are a big pain.

(They're worse than a pain if they induce programmers to turn off all
warnings.)

Sometimes, the only reason the compiler can't tell is due to separate
compilation.  Another thread has already beat to death the reason why this
is not true of GNAT.  If you're not using gnat, independent tools do exist
that can change the "unknown" to "correct" or "wrong" in many cases.

How about having a compiler make an optional SINGLE warning for each
invokation something like:

    COMPILER WAS UNABLE TO DETERMINE WHETHER THE FOLLOWING
        ITEMS WERE INITIALIZED BEFORE BEING REFERENCED:

Identifier                    File                                Line No.
----------------------------  ----------------------------------  --------
PKG.PROC.PROC.VRBL.FIELD      some_ada_source_file.ada              65,736
.....

Yes, go ahead and use this example to justify putting
thousands of lines in a source file.  NOT!   :-)

---------------------------------------------------------------------------
W. Wesley Groleau (Wes)                                Office: 219-429-4923
Magnavox - Mail Stop 10-40                               Home: 219-471-7206
Fort Wayne,  IN   46808              elm (Unix): wwgrol@pseserv3.fw.hac.com
---------------------------------------------------------------------------




^ permalink raw reply	[flat|nested] 104+ messages in thread
* Uninitialized out parameters.
@ 2016-04-05 12:02 ahlan
  2016-04-05 13:17 ` rieachus
                   ` (2 more replies)
  0 siblings, 3 replies; 104+ messages in thread
From: ahlan @ 2016-04-05 12:02 UTC (permalink / raw)


Hi,

Is this a GNAT (GPL-2015) bug or my not understanding Ada?

I was surprised that I could compile
  procedure Test (V : out Positive) is null;

and even more by the results of calling the procedure 

  V : Positive;
begin
  Test (V);
  Ada.Text_IO.Put_Line ("V:" & V'img);

The value zero is output, which because V is positive should be impossible.

I would have thought that null procedures with out parameters would fail to compile. 

Opinions anyone?

MfG
Ahlan

^ permalink raw reply	[flat|nested] 104+ messages in thread

end of thread, other threads:[~2016-04-08  7:32 UTC | newest]

Thread overview: 104+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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   ` 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-19  0:00   ` Dale Stanbrough
1996-07-19  0:00     ` Adam Beneschan
1996-07-19  0:00     ` James A. Squire
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                 ` Robert A Duff
1996-07-25  0:00                   ` Richard A. O'Keefe
1996-07-24  0:00                 ` Fergus Henderson
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                 ` Theodore E. Dennison
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-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               ` Fergus Henderson
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-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 ` Peter Amey
1996-07-19  0:00 ` Michel Gauthier
1996-07-21  0:00   ` Robert A Duff
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       ` Richard A. O'Keefe
1996-07-25  0:00         ` Robert A Duff
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

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