Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2002:
[Freeciv-Dev] Re: New Patch
Home

[Freeciv-Dev] Re: New Patch

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Tony Stuckey <stuckey@xxxxxxxxxxxxxxxxx>
Cc: rf13@xxxxxxxxxxxxxxxxxxxxxx, Alexander Mai <st002279@xxxxxxxxxxxxxxxxxxxxxx>, "freeciv-dev@xxxxxxxxxxx" <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: New Patch
From: Vasco Alexandre Da Silva Costa <vasc@xxxxxxxxxxxxxx>
Date: Wed, 6 Feb 2002 22:28:41 +0000 (WET)

On Wed, 6 Feb 2002, Tony Stuckey wrote:

> On Wed, Feb 06, 2002 at 07:32:16PM +0100, Raimar Falke wrote:
> > I agree that casting to unsigned long int is the safest thing to do in
> > general. However in the case you want to change it is unnecessary
> > (unless you have a system where size_t is a long).
> 
>       Isn't this true of the Alpha?  Or am I simply misremembering?

Yes. In the DEC (now Compaq) Alpha int is 32bits, long is 64 bits and
memory address sized types like size_t and ptrdiff_t are 64 bits too.

Printing a size_t as a long isn't fullproof either. Nothing prevents a
future machine from having a 128-bit addressing space, and long isn't
garanteed to be the same size as a size_t. Only >= size of int.

(Yes i know a 128-bit addressing space sounds too big to even imagine, but
remember, 640Kb is enough for everyone).

The cast to int Raimar used is a valid solution since the size of his
struct fits in an int, and since this is just for a freelog function it
wouldn't be too important if it didn't either.

I would prefer if it was casted to an unsigned instead of an int though.
But that doesn't matter in this case.

---
Vasco Alexandre da Silva Costa @ Instituto Superior Tecnico, Lisboa



[Prev in Thread] Current Thread [Next in Thread]