From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5697899e4423465c X-Google-Attributes: gid103376,public From: stt@houdini.camb.inmet.com (Tucker Taft) Subject: Re: Boolean Representation Date: 1998/09/25 Message-ID: #1/1 X-Deja-AN: 394742811 Sender: news@inmet.camb.inmet.com (USENET news) X-Nntp-Posting-Host: houdini.camb.inmet.com References: <6udkck$87k$1@nnrp1.dejanews.com> Organization: Intermetrics, Inc. Newsgroups: comp.lang.ada Date: 1998-09-25T00:00:00+00:00 List-Id: 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