Re: Integers on 64-bit machines

torbenm@app-6.diku.dk (Torben =?iso-8859-1?Q?=C6gidius?= Mogensen)
Mon, 09 Jul 2007 09:50:05 +0200

          From comp.compilers

Related articles
[11 earlier articles]
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)
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)
[4 later articles]
| List of all articles for this month |

From: torbenm@app-6.diku.dk (Torben =?iso-8859-1?Q?=C6gidius?= Mogensen)
Newsgroups: comp.compilers
Date: Mon, 09 Jul 2007 09:50:05 +0200
Organization: Department of Computer Science, University of Copenhagen
References: 07-07-007 07-07-021 07-07-025 07-07-030
Keywords: arithmetic, design, storage
Posted-Date: 12 Jul 2007 22:01:57 EDT

anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:




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


Pointer arithmetic does not require pointers and integers to be of the
same size. All that is required is that an integer can hold the
number of elements in an allocated array, so the difference of two
pointers into the same array can fit in an integer. Since it makes
sense to have virtual addresses much larger than physical memory, it
also makes sense to have addresses larger than integers.


Casting pointers to integers is an abomination.


> I think that a zoo of types is worse than marshalling, and you have to
> marshal anyway if your structure involves pointers.


I think machine-dependent integers is a much worse impediment to
marshalling than subrange types. With machine-dependent integers, you
can't write machine-independent marshalling code. And with
marshalling/unmarshalling you can't even be sure that the unmarshaller
has the same size ints as the marshaller, so you can get into loads of
trouble if you are not careful (such as storing the size of the number
with each number).


When marshalling structures that use pointers, all you need is an
ability to find the offset between two pointers in the same allocated
array and to comapre two pointer that are not in the same allocated
array for equality. Noone in their right mind would marshal a pointer
as its bit pattern. What you need is information sufficient to
reconstruct an equivalent heap structure -- without keeping exact
addresses.


Torben



Post a followup to this message

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