Re: Integers on 64-bit machines
- From: anton@xxxxxxxxxxxxxxxxxxxxxxxxxx (Anton Ertl)
- Date: Thu, 05 Jul 2007 18:09:41 GMT
Denis Washington <dwashington@xxxxxxx> 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@xxxxxxxxxxxxxxxxxxxxxxxxxx
http://www.complang.tuwien.ac.at/anton/
.
- Follow-Ups:
- Re: Integers on 64-bit machines
- From: Marco van de Voort
- Re: Integers on 64-bit machines
- References:
- Integers on 64-bit machines
- From: Denis Washington
- Integers on 64-bit machines
- Prev by Date: Re: Dominance frontier example in Engineering a Compiler
- Next by Date: Re: Integers on 64-bit machines
- Previous by thread: Re: Integers on 64-bit machines
- Next by thread: Re: Integers on 64-bit machines
- Index(es):
Relevant Pages
|
|