comp.lang.ada
 help / color / mirror / Atom feed
From: steved@pacifier.com@199.2.117.163  (Steve Doiel)
Subject: Re: Prevalence of Compilers for Which Integer'Size < 32?
Date: 1996/08/01
Date: 1996-08-01T00:00:00+00:00	[thread overview]
Message-ID: <4tpaa5$7n5@news.pacifier.com> (raw)
In-Reply-To: dewar.838766184@schonberg


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





  reply	other threads:[~1996-08-01  0:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-07-26  0:00 Prevalence of Compilers for Which Integer'Size < 32? Dave Marshall
1996-07-27  0:00 ` steved
1996-07-28  0:00   ` Dave Marshall
1996-07-28  0:00     ` Robert Dewar
1996-07-28  0:00     ` Robert A Duff
1996-07-28  0:00       ` Robert Dewar
1996-07-29  0:00         ` Robert A Duff
1996-07-28  0:00     ` steved
1996-07-28  0:00   ` Robert A Duff
1996-07-30  0:00     ` Ken Garlington
1996-07-30  0:00       ` Robert Dewar
1996-08-01  0:00         ` steved [this message]
     [not found]         ` <31FF5CF0.5C13@lmtas.lmco.com>
1996-08-03  0:00           ` Robert Dewar
1996-08-07  0:00             ` Ken Garlington
  -- strict thread matches above, loose matches on Subject: below --
1996-07-28  0:00 tmoran
1996-07-29  0:00 ` John Herro
replies disabled

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