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.2 required=5.0 tests=BAYES_00,FROM_NUMERIC_TLD, INVALID_MSGID,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d7ae8269a4ecf7c4 X-Google-Attributes: gid103376,public From: steved@pacifier.com@199.2.117.163 (Steve Doiel) Subject: Re: Prevalence of Compilers for Which Integer'Size < 32? Date: 1996/08/01 Message-ID: <4tpaa5$7n5@news.pacifier.com>#1/1 X-Deja-AN: 171333227 references: <4tdp24$5h1@news.pacifier.com> <31FE0C01.302F@lmtas.lmco.com> organization: Pacifier BBS, Vancouver, Wa. ((360) 693-0325) reply-to: steved@pacifier.com (Steve Doiel) newsgroups: comp.lang.ada Date: 1996-08-01T00:00:00+00:00 List-Id: Robert Dewar writes: >Ken Garlington said (in partial jest, I realize) > >Because it's not: > > Bits_32 : constant := 32; > type anInt32 is range -(2**(Bits_32-1)) .. 2**(Bits_32-1)-1; > > >But in fact Bits_32 is a horrible name. I like named constants, but I >don't like junk names. The above would be reasonable if the name >Bits_32 were something like Word_Length_In_Bits. > Ya know, I find this discussion interesting. At the Tri-Ada 95' opening address a representative from Silicon Graphics (sorry I don't recall his name) talked briefly about cognitive recognition. He used the example of the filesystem that was displayed briefly on Jurrasic Park, where the type and size of files was shown with 3D images. He explained that humans can visually recognize thins very quickly based on visual queues. I am sure this isn't news to many, and you may be wondering what it has to do with this discussion but... How code looks to you is directly dependent on what you are accustomed to. For me the following: Bits_32 : constant := 32; type anInt32 is range -(2**(Bits_32-1)) .. 2**(Bits_32-1)-1; Is actually less readable than: type anInt32 is range -(2**31) .. 2**31-1; The extra identifier and definitions add clutter without gaining in readability. In my own code I actually might use: TYPE anInt32 IS RANGE -(16#FFFF_FFFF#)..16#7FFF_FFFF#; Since when I am defining a 32 bit integer, I probably plan to use it for for something that is machine related, at which time I tend to thing in terms of bytes and words in hex. Also on the topic of recognition. I find that consistant use of case and naming adds to the speed of recognition. I happen to like my keywords in upper case. All of my type defintions start with "a" or "an" in lower case and are followed by mixed case. All procedure and function names begin with upper case followed by mixed case. I know that when I look at code that is formatted in the way that I am used to I can get my bearings very quickly. And when I find scattered bits that are formatted differently, things become very hard to read. Definitely more than you wanted to hear... Steve Doiel