comp.lang.ada
 help / color / mirror / Atom feed
From: stt@houdini.camb.inmet.com (Tucker Taft)
Subject: Re: Boolean Representation
Date: 1998/09/25
Date: 1998-09-25T00:00:00+00:00	[thread overview]
Message-ID: <EzuGHH.C6E.0.-s@inmet.camb.inmet.com> (raw)
In-Reply-To: 6udkck$87k$1@nnrp1.dejanews.com

matthew_snyder@my-dejanews.com wrote:

: Is it safe to assume that a boolean value of FALSE is always internally
: represented as 0 and TRUE is represented as 1 for most Ada compilers?  Will
: the results of an unchecked conversion from a boolean to an integer be
: consistent for different compilers?

To answer your original question:

   The answer is "no."  Boolean is the only enumeration
   type where the "default" representation need not start at 0
   and go up by consecutive integers.

We argued a bit over this during the Ada 9X design process.  We
agreed that all user-defined enumeration types should be guaranteed
a default representation that was 0-based.  However, there was
existing hardware for which 0,16#FFFF_FFFF# was a better 
representation to use for boolean (due to the set-zero/set-ones
instructions, e.g. on the 68K).  Furthermore, some existing
Ada 83 compilers took advantage of this.

See RM95 13.4(8), and AARM 13.4(8a,8b).


: Matt Snyder
: matthew_snyder@hotmail.com

--
-Tucker Taft   stt@inmet.com   http://www.inmet.com/~stt/
Intermetrics, Inc.  Burlington, MA  USA
An AverStar Company




  reply	other threads:[~1998-09-25  0:00 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-09-24  0:00 Boolean Representation matthew_snyder
1998-09-25  0:00 ` Tucker Taft [this message]
1998-09-25  0:00   ` dewarr
1998-09-25  0:00   ` dewarr
  -- strict thread matches above, loose matches on Subject: below --
1998-09-24  0:00 matthew_snyder
1998-09-24  0:00 ` dennison
1998-09-24  0:00   ` Keith Thompson
1998-09-25  0:00     ` dennison
1998-09-25  0:00       ` Keith Thompson
1998-09-26  0:00         ` Tucker Taft
1998-09-26  0:00           ` Keith Thompson
1998-09-27  0:00             ` dewarr
1998-09-27  0:00           ` dewarr
1998-09-24  0:00 ` dewarr
1998-09-24  0:00   ` Samuel T. Harris
1998-09-25  0:00     ` dewarr
1998-09-27  0:00       ` Samuel T. Harris
1998-09-28  0:00         ` dewar
1998-09-24  0:00   ` matthew_snyder
1998-09-24  0:00     ` Tom Moran
1998-09-25  0:00       ` dewarr
1998-09-25  0:00         ` Tom Moran
1998-09-24  0:00     ` dennison
1998-09-25  0:00     ` dewarr
1998-09-25  0:00     ` Robert I. Eachus
replies disabled

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