Re: Integers on 64-bit machines

anton@mips.complang.tuwien.ac.at (Anton Ertl)
Fri, 06 Jul 2007 09:00:25 GMT

          From comp.compilers

Related articles
[7 earlier articles]
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)
Re: Integers on 64-bit machines anton@mips.complang.tuwien.ac.at (2007-07-06)
Re: Integers on 64-bit machines marcov@stack.nl (Marco van de Voort) (2007-07-08)
Re: Integers on 64-bit machines cfc@shell01.TheWorld.com (Chris F Clark) (2007-07-08)
Re: Integers on 64-bit machines DrDiettrich1@aol.com (Hans-Peter Diettrich) (2007-07-09)
Re: Integers on 64-bit machines torbenm@app-6.diku.dk (2007-07-09)
Re: Integers on 64-bit machines gneuner2@comcast.net (George Neuner) (2007-07-09)
Re: Integers on 64-bit machines dot@dotat.at (Tony Finch) (2007-07-09)
[8 later articles]
| List of all articles for this month |

From: anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.compilers
Date: Fri, 06 Jul 2007 09:00:25 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
References: 07-07-007 07-07-021 07-07-025
Keywords: C, arithmetic

Marco van de Voort <marcov@stack.nl> writes:
>On 2007-07-05, Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
>> 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.
>
>In C, integers have no connection to pointers, long has.


long is an integer type. And long has no more connection to pointers
than int, neither in the standard nor in practice (e.g., on the
PDP-11, i.e., the classical C implementation, long is 32-bit and
pointers and ints are 16 bit.


What I meant with the connection between integers and pointers is that
one can do pointer arithmetic and cast between pointers and integers.


>You need a range of fixed types ints anyway to be able to define a
>structure that maps (at least nearly) any external structure, so that
>you can communicate without marshalling.


I think that a zoo of types is worse than marshalling, and you have to
marshal anyway if your structure involves pointers. In any case,
there are also other alternatives, e.g., one could allow the
fixed-size types only in structures.


>[Jeez, I thought we got away from the abomination of pointers that are
>longer than ints when we left the 286 large mode. No such luck, huh? -John]


No, the 286 guys took over the C compiler groups of MIPS and DEC and
invented the I32LP64 model, so that Unix programmers had to suffer
just as much as DOS programmers used to. But that's water down
the river.


- 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.