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

In article <EzuGHH.C6E.0.-s@inmet.camb.inmet.com>,
  stt@houdini.camb.inmet.com (Tucker Taft) wrote:
> 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
>


Yes, Tuck, but in the application at hand, the boolean values fit in one
bit, as the questioner later makes clear, and in that case it appears that
the only valid representation is 0 for false, and 1 for true!

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum




  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
1998-09-25  0:00   ` dewarr [this message]
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   ` matthew_snyder
1998-09-24  0:00     ` dennison
1998-09-24  0:00     ` Tom Moran
1998-09-25  0:00       ` dewarr
1998-09-25  0:00         ` Tom Moran
1998-09-25  0:00     ` dewarr
1998-09-25  0:00     ` Robert I. Eachus
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
replies disabled

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