comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@cs.nyu.edu (Robert Dewar)
Subject: Re: Uninitialized "out" parameters
Date: 1996/07/23
Date: 1996-07-23T00:00:00+00:00	[thread overview]
Message-ID: <dewar.838165848@schonberg> (raw)
In-Reply-To: 4t3f1u$t0u@newsbf02.news.aol.com


John Herro said

"     If "Ada, oh why?" does the same thing by default, it would use extra
memory and CPU time, but improve reliability and increase the chances of
detecting errors.  This is certainly in keeping with the Ada philosophy.
It's analogous to Ada doing bounds checking at run time, which can be
turned off with a pragma."


It is quite unlikely that the parameters that went into the original
Ada 83 decision will have changed, they certainly had not changed for
Ada 95, and I don't see any likelihood that architectures will develop
in a direction that makes this feasible.

It is not at all analogous to bounds checking. The point with bounds
checking is that the cost of this checking, with good compiler
optimization, is quite reasonable (in the 10-20% range at most, for
typical programs).

The cost of runtime checking of uninitialized variables is MUCH higher.
If you have a type which fills the complete hardware type (e.g. Character,
or Unsigned_32, or, in any reasonable implementation Integer), then
you have to maintain and test a separate boolean bit. Not only does this
double the register pressure, but also it generates potential pipeline
breaks in many architectures which would be very harmful peformance.

Of course there may be specialized architectures which make this kind of
testing feasible, and of course you are certainly allowed to implement
this in Ada 83 or Ada 95 (raising Program_Error as the result of failing
the test), but it is interesting to note that there has been almost no
demand for such implementations, since in the real world, the interest
in performance and easy interface to the outside world would mean that
these checks would almost always have to be suppressed.

The challenge of the Ada design is to provide a reasonable selection of
default runtime checks that do not seriously impact performance. It is
of course possible to check everything at runtime, including for example
incorrect use of unchecked_conversion and unchecked_deallocation, but
these checks are deemed simply too expensive, given the goal of providing
a usable high efficiency language.

C and C++ take the position of checking nothing at runtime. Some other
languages are completely protected (e.g. SNOBOL-4 or SETL). Ada tries
to get most of the advantages of runtime checking without paying too
high a price. Checking for uninitialized variables is deemed across
the line (note that this decision was not particularly controversial,
though it was discussed). One thing that John may not realize is that
the intent is that the checks in Ada be inexpensive enough that many
or most real applicatoins can afford to leave them on. 

I certainly understand that beginners may want an Ada system that checks
uninitialized  variables, and of course Ada/Ed always had this capability,
but it does not seem a significant priority in commercial implementations
of Ada (by commercial here, I mean usable in real applications).

I certainly see nothing in this discussion that has added anything to the
understanding of the issue when it was first discussed (with respect to
Ada) twenty years ago. If anything the development of RISC architectural
techniques has strengthened the argument *against* adding such a requirement,
and it did not even come up in the revision (I can't even rememeber it being
mentioned in the revision requests, and they sure mentioned lots of stuff!)





  parent reply	other threads:[~1996-07-23  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   ` 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     ` 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-19  0:00     ` Adam Beneschan
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 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             ` 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           ` 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 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-23  0:00   ` Robert Dewar [this message]
1996-07-24  0:00     ` Uninitialized "out" parameters Peter Hermann
1996-07-26  0:00   ` 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