comp.lang.ada
 help / color / mirror / Atom feed
From: bobduff@world.std.com (Robert A Duff)
Subject: Re: Prevalence of Compilers for Which Integer'Size < 32?
Date: 1996/07/29
Date: 1996-07-29T00:00:00+00:00	[thread overview]
Message-ID: <DvB4oK.MB1@world.std.com> (raw)
In-Reply-To: dewar.838610210@schonberg


In article <dewar.838610210@schonberg>, Robert Dewar <dewar@cs.nyu.edu> wrote:
>because it is much easier to see that 86_400 is bigger than 32767 than
>it is to see that 60*60*24 is bigger than 2**15-1 :-)

Good point.  But in another post in this thread, it would have been
pretty easy to see that 2**31-1 is bigger than 2**15-1.

I refuse to memorize the decimal value of 2**31 -- it's a waste a of
brain cells.  I just know that it's a little over 2 billion (for the
U.S. meaning of "billion"), and that's enough.

I've seen a lot of Ada code that uses giant literals, when a static
expression like 2**31-1 or whatever would have been more readable.  E.g.
I've seen:

    X: constant := 2_147_883_648; -- 2**31

Never use a comment when you can say it in the language proper.

I've also seen things like:

    X: Integer := 100000000; -- ten million

where the programmer apparently didn't realize that underscores are
allowed, and make things more readable.  And I've even seen bugs (as in
the above) because the number of zeros was miscounted.

- Bob




  reply	other threads:[~1996-07-29  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     ` steved
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 [this message]
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
     [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