Re: Integers on 64-bit machines

anton@mips.complang.tuwien.ac.at (Anton Ertl)
Thu, 05 Jul 2007 18:09:41 GMT

          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)
[16 later articles]
| List of all articles for this month |

From: anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.compilers
Date: Thu, 05 Jul 2007 18:09:41 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
References: 07-07-007
Keywords: arithmetic, design
Posted-Date: 05 Jul 2007 15:35:13 EDT

Denis Washington <dwashington@gmx.net> writes:
>I'm currently developing a little C-like programming language as a
>hobby project. After having implemented the basic integral integer
>types like known from Java/C# (with fixed sizes for each type), I
>thought a bit about 64-bit machines and wanted to ask: if you develop
>on a 64-bit machine, would it be preferable to still leave the
>standard integer type ("int") 32-bit, or would it be better to have
>"int" grow to 64 bit? In this case, I could have an
>architecture-dependent "int" type along with fixed-sized types like
>"int8", "int16", "int32" etc.


For a C-like language (i.e., where integers have some connection to
pointers, e.g., pointer arithmetic), the main integer type should have
the same size as a pointer; for your 64-bit machines, it should be 64
bits.


As for having a zoo of integer types like C, that's a bad idea in my
experience. It causes lots of portability bugs; in contrast, in Forth
there's one dominant integer type, the cell, which can also contain an
address; in Forth portability bugs between 32-bit and 64-bit systems,
and between different byte orders are very rare.


- anton
--
M. Anton Ertl
anton@mips.complang.tuwien.ac.at
http://www.complang.tuwien.ac.at/anton/



Post a followup to this message

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