Re: Integers on 64-bit machines

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Thu, 5 Jul 2007 22:33:01 +0200

          From comp.compilers

Related articles
Integers on 64-bit machines dwashington@gmx.net (Denis Washington) (2007-07-02)
Re: Integers on 64-bit machines torbenm@app-3.diku.dk (2007-07-04)
Re: Integers on 64-bit machines marcov@stack.nl (Marco van de Voort) (2007-07-04)
Re: Integers on 64-bit machines emailamit@gmail.com (Amit Gupta) (2007-07-05)
Re: Integers on 64-bit machines DrDiettrich1@aol.com (Hans-Peter Diettrich) (2007-07-05)
Re: Integers on 64-bit machines anton@mips.complang.tuwien.ac.at (2007-07-05)
Re: Integers on 64-bit machines mailbox@dmitry-kazakov.de (Dmitry A. Kazakov) (2007-07-05)
Re: Integers on 64-bit machines gah@ugcs.caltech.edu (glen herrmannsfeldt) (2007-07-05)
Re: Integers on 64-bit machines bobduff@shell01.TheWorld.com (Robert A Duff) (2007-07-05)
Re: Integers on 64-bit machines marcov@stack.nl (Marco van de Voort) (2007-07-06)
Re: Integers on 64-bit machines DrDiettrich1@aol.com (Hans-Peter Diettrich) (2007-07-06)
Re: Integers on 64-bit machines DrDiettrich1@aol.com (Hans-Peter Diettrich) (2007-07-06)
Re: Integers on 64-bit machines DrDiettrich1@aol.com (Hans-Peter Diettrich) (2007-07-06)
[15 later articles]
| List of all articles for this month |

From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Newsgroups: comp.compilers
Date: Thu, 5 Jul 2007 22:33:01 +0200
Organization: Compilers Central
References: 07-07-007 07-07-014 07-07-017
Keywords: types, comment
Posted-Date: 05 Jul 2007 19:28:03 EDT

On Thu, 05 Jul 2007 07:00:09 +0200, Hans-Peter Diettrich wrote:


> IMO users are not very pleased with multiple fixed-size integer types,
> which require a careful selection for every local variable. Not to
> mention the documentation for every decision... ;-)


Hmm, if you take int16 to hold values from the range 1..512, then you
indeed have to document somewhere that 513 is not a legal value. On the
contrary when you write in the program:


      type Foo is range 1..512;


then that barely requires further documentation. But what is more important
is that an exception will be raised when -3 is assigned to a variable of
the type Foo.


> [Defining the range for each variable is one of those ideas that seems
> like a good idea but in practice, programmers don't do it.


True, range (or more general constraint) is a property of a type or a
subtype. It is not a property of a variable.


--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
[The problem isn't that it's a variable rather than a type, the problem is
that programmers aren't very good at predicting the range of values
that a variable can take, so they won't try. If you force them to do so,
as PL/I does, they'll pick a size that works reasonably consistently and
always use that. -John]


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.