comp.lang.ada
 help / color / mirror / Atom feed
From: Keith Thompson <kst@cts.com>
Subject: Re: Constraint checking of actuals passed to Attributes
Date: 2000/05/09
Date: 2000-05-09T00:00:00+00:00	[thread overview]
Message-ID: <yecitwn9kmr.fsf@king.cts.com> (raw)
In-Reply-To: wccitwnmi4r.fsf@world.std.com

Robert A Duff <bobduff@world.std.com> writes:
[...]
> I suppose I could try expressing the intent by example:
> 
> If you say:
> 
>     Uninit: Integer; -- Uninitialized variable!
>     ...
>     if Uninit < 10 then
>         ...
> 
> The condition must be either True or False, or it must raise an
> exception.  It must not destroy other variable's values.  Inside the
> if statement, Uninit must evaluate to a value less than 10.
> 
> Obviously that's not a formal definition -- it's just an example of the
> intent.

If I understand the context of this example correctly, the intent is
to make these guarantees if Uninit is merely uninitialized, but not if
it's abnormal (say, if an assignment to it was disrupted; see
RM95-13.9.1).  The standard doesn't require bizarre things to happen
under such circumstances, it merely withdraws its usual guarantee that
bizarre things won't happen.  If the underlying hardware has no
abnormal representations for type Integer, Integers will never become
abnormal ("Whether or not an object actually becomes abnormal in these
cases is not specified.")

This kind of thing is more likely to show up (on most systems) for
things like composite objects with corrupted descriptors.  The most
plausible scenario for type Integer that I can think of is a system
that represents an integer as a floating-point value with the exponent
set to zero (I'm not sure whether Ada allows this); something like a
floating-point NaN would then be an abnormal value for type Integer.
A less plausible scenario is
an integer with the low-order bit set to 0.5.

I suppose the real requirement being imposed here is that, if the
underlying system has "abnormal" representations for a given type, the
Ada implementation must guarantee that an uninitialized variable isn't
set to one of those representations.

-- 
Keith Thompson (The_Other_Keith) kst@cts.com  <http://www.ghoti.net/~kst>
San Diego Supercomputer Center           <*>  <http://www.sdsc.edu/~kst>
Welcome to the last year of the 20th century.




  reply	other threads:[~2000-05-09  0:00 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-05-05  0:00 Constraint checking of actuals passed to Attributes Matt Brennan
2000-05-05  0:00 ` Keith Thompson
2000-05-08  0:00 ` Tucker Taft
2000-05-09  0:00   ` Robert Dewar
2000-05-09  0:00     ` Ted Dennison
2000-05-09  0:00       ` Robert Dewar
2000-05-09  0:00         ` Ted Dennison
2000-05-09  0:00           ` Robert Dewar
2000-05-09  0:00             ` Ted Dennison
2000-05-09  0:00               ` Robert A Duff
2000-05-09  0:00     ` Robert A Duff
2000-05-09  0:00       ` Robert Dewar
2000-05-09  0:00         ` Robert A Duff
2000-05-09  0:00           ` Keith Thompson [this message]
2000-05-10  0:00             ` Robert A Duff
2000-05-14  0:00               ` Simon Wright
2000-05-17  0:00                 ` Robert A Duff
2000-05-12  0:00             ` Tucker Taft
2000-05-12  0:00               ` Ted Dennison
2000-05-12  0:00                 ` Robert A Duff
2000-05-12  0:00                   ` Ted Dennison
2000-05-16  0:00                     ` Robert A Duff
2000-05-16  0:00                       ` Ted Dennison
2000-05-17  0:00                       ` Robert Dewar
2000-05-10  0:00           ` Robert Dewar
2000-05-10  0:00             ` Robert A Duff
2000-05-15  0:00             ` Bill Greene
2000-05-10  0:00           ` David C. Hoos, Sr.
2000-05-22  0:00           ` Kenneth Almquist
2000-05-10  0:00   ` Matt Brennan
replies disabled

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