Re: Integers on 64-bit machines

Marco van de Voort <marcov@stack.nl>
Tue, 10 Jul 2007 09:19:50 +0000 (UTC)

          From comp.compilers

Related articles
[14 earlier articles]
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)
Re: Integers on 64-bit machines marcov@stack.nl (Marco van de Voort) (2007-07-10)
Re: Integers on 64-bit machines DrDiettrich1@aol.com (Hans-Peter Diettrich) (2007-07-13)
Re: Integers on 64-bit machines cfc@shell01.TheWorld.com (Chris F Clark) (2007-07-13)
Re: Integers on 64-bit machines napi@axiomsol.com (napi) (2007-07-13)
Re: Integers on 64-bit machines monnier@iro.umontreal.ca (Stefan Monnier) (2007-07-14)
Re: Integers on 64-bit machines gneuner2@comcast.net (George Neuner) (2007-07-16)
Re: Integers on 64-bit machines DrDiettrich1@aol.com (Hans-Peter Diettrich) (2007-07-19)
[1 later articles]
| List of all articles for this month |

From: Marco van de Voort <marcov@stack.nl>
Newsgroups: comp.compilers
Date: Tue, 10 Jul 2007 09:19:50 +0000 (UTC)
Organization: Stack Usenet News Service
References: 07-07-007 07-07-021 07-07-025 07-07-030
Keywords: C, arithmetic, design
Posted-Date: 12 Jul 2007 22:08:04 EDT

On 2007-07-06, Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
> 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.


_an_ integer type, but not the "main" integer type.


> And long has no more connection to pointers
> than int, neither in the standard nor in practice


No the standard is indeed vague. What I mentioned is afaik more POSIX. And
probably it is not equal, but equal or greater.


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


One can also do this (using the suitable integer type) if the main type
isn't. But that allows the compiler some leeway in which precision it does
non pointer related arithmetic.


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


External to the language (e.g. OS or foreign library), not necessarily
external to the process.


> In any case, there are also other alternatives, e.g., one could allow the
> fixed-size types only in structures.


IMHO one should simply declare one type pointer compatible, and be done with
it. I know this has been tried in the past, and some companies have deviated
again (LLP64 model), but I don't see to need to blow up the integer
unnecessarily.


I don't see much advantages in equating pointer and integer. If people
deviate from rules (like with LLP), any scheme breaks.



Post a followup to this message

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