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: dewarr@my-dejanews.com Subject: Re: Boolean Representation Date: 1998/09/25 Message-ID: <6ugne4$gmq$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 394795865 References: <6udkck$87k$1@nnrp1.dejanews.com> X-Http-Proxy: 1.0 x3.dejanews.com:80 (Squid/1.1.22) for client 205.232.38.14 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Fri Sep 25 18:29:25 1998 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/2.02 (OS/2; I) Date: 1998-09-25T00:00:00+00:00 List-Id: In article , 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