comp.lang.ada
 help / color / mirror / Atom feed
From: mfeldman@seas.gwu.edu (Michael Feldman)
Subject: Re: Pre-condition vs. Post-condition
Date: 26 Mar 91 16:44:11 GMT	[thread overview]
Message-ID: <2929@sparko.gwu.edu> (raw)
In-Reply-To: 5070@goanna.cs.rmit.oz.au

In article <5070@goanna.cs.rmit.oz.au> ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) writes:
>
>global variables with the desired array sizes were initialised.  Now C
>has this helpful little rule that global variables are initialised to
>0 (0.0, NIL, ASCII.NUL, FALSE, or whatever the equivalent happens to be).
>Precisely *because* the variables were initialised to a "sensible" value
>the error was unexpectedly hard to detect.

I don't think the _compiler_ (or the standard) should micro-manage what
should be a programmer's responsibility, namely determining, type by type,
what a "sensible" value means.
>
>Don't expect default initial values for types to be an unmixed blessing.
>
Perhaps we have a terminological problem here. By "default initial value"
we do _not_ mean "the compiler determines the value." We _do_ mean "the
programmer has the option of specifying the initializing value, and
all declared objects then have this value when they are elaborated."
This is only inconsistently possible in Ada83. 

If if we wanted the compiler to do it, things are easier said than done.
Given things like range constraints, etc., which C doesn't have to
worry about, it could be messy for the compiler to determine what the
initial value should be. E.g. 0 isn't a sensible initial value for
a Positive subtype. Perhaps Type'First would make sense, but I
still think this would micro-manage what should be a project choice.
Give the programmer the option.

Taking it a step further, the Ada9x standard _could_ REQUIRE that the
programmer give all types default initial values. I favor this;
I think it corresponds to the Dijkstra notation you were referring to.
Going that far may be controversial; I'd settle for a consistent rule
_allowing_ the programmer to do it.

Mike Feldman

  reply	other threads:[~1991-03-26 16:44 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1991-03-24 21:23 Pre-condition vs. Post-condition stt
1991-03-25 16:00 ` Arthur Evans
1991-03-25 17:05   ` Michael Feldman
1991-03-26  4:31     ` Jim Showalter
1991-03-26 10:21       ` Richard A. O'Keefe
1991-03-26 16:44         ` Michael Feldman [this message]
1991-03-26 22:03           ` Richard A. O'Keefe
1991-03-26 23:36             ` Michael Feldman
1991-03-28 20:43               ` Pre-condition vs. Post-condition (actually inintialization) Dana Carson
1991-03-27 21:34             ` Pre-condition vs. Post-condition Jim Showalter
1991-03-28  2:54               ` Michael Feldman
1991-03-29  3:28                 ` Jim Showalter
1991-03-27  3:12         ` Jim Showalter
1991-03-27 21:32         ` Initialization Paul Stachour
  -- strict thread matches above, loose matches on Subject: below --
1991-03-18 15:47 Pre-condition vs. Post-condition "Norman H. Cohen"
1991-03-15  3:57 Chris M. Little
1991-03-15 19:07 ` Michael Feldman
1991-03-17 12:26   ` George C. Harrison, Norfolk State University
1991-03-18 15:04   ` Joe Hollingsworth
1991-03-18 19:51     ` Marlene M. Eckert
1991-03-19 19:07       ` Michael Feldman
1991-03-21  3:01         ` Jim Showalter
1991-03-21 18:40           ` Michael Feldman
1991-03-19 20:38       ` Charles H. Sampson
1991-03-21  3:06         ` Jim Showalter
1991-03-19 21:07       ` Jim Showalter
1991-03-19  7:38     ` Jim Showalter
1991-03-19 14:46       ` Joe Hollingsworth
1991-03-21  2:46         ` Jim Showalter
1991-03-22 15:18       ` Brad Balfour
1991-03-19 18:17   ` Mike Gilbert
replies disabled

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