comp.lang.ada
 help / color / mirror / Atom feed
From: bobduff@world.std.com (Robert A Duff)
Subject: Re: [Q] To initialise or not.
Date: 1996/04/27
Date: 1996-04-27T00:00:00+00:00	[thread overview]
Message-ID: <DqJ9D6.345@world.std.com> (raw)
In-Reply-To: dewar.830583555@schonberg


In article <dewar.830583555@schonberg>, Robert Dewar <dewar@cs.nyu.edu> wrote:
>The whole idea is to guarantee predictability by initializing everything
>to a known and consistent value, WITHOUT necessarily providing a valid
>value on which the proram could (incorrectly) depend.

Right.  In fact, the compiler is *supposed* to initialize to an
*invalid* value, whenever possible, in order to cause an exception.
The reason this is not *required* is that some types don't have any
invalid values.  For example, type Integer likely uses up all the
available bits for representing valid values, and we didn't want to
require the compiler to store an extra bit in those cases.  Requiring
that would complicate the compiler, cause inefficiency, and cause
trouble when interfacing to other languages.

Another example: in a packed array of Booleans, you get one bit per
component, which doesn't leave any extra bits for invalid values.  A
stand-alone Boolean variable, on the other hand, will probably get 8
bits, or 32 bits, so pragma Normalize_Scalars will cause "X: Boolean;"
to be initialized to some bit pattern that represents neither True nor
False.

- Bob




  reply	other threads:[~1996-04-27  0:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-04-25  0:00 [Q] To initialise or not JP Thornley
1996-04-26  0:00 ` Ken Garlington
1996-04-26  0:00 ` Theodore E. Dennison
1996-04-26  0:00   ` Robert A Duff
1996-04-27  0:00     ` Thorsten Behrens
1996-04-28  0:00       ` Robert Dewar
1996-04-30  0:00       ` mjp
1996-05-02  0:00       ` Bob Gilbert
1996-04-26  0:00 ` Ken Garlington
1996-04-26  0:00   ` Robert A Duff
1996-04-27  0:00   ` Robert Dewar
1996-04-27  0:00     ` Robert A Duff [this message]
1996-04-26  0:00 ` Robert I. Eachus
1996-04-27  0:00 ` Robert Dewar
replies disabled

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