[Freeciv-Dev] Re: New Patch
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
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
- [Freeciv-Dev] Re: New Patch, (continued)
- [Freeciv-Dev] Re: New Patch, Alexander Mai, 2002/02/06
- [Freeciv-Dev] Re: New Patch, Ben Webb, 2002/02/06
- [Freeciv-Dev] Re: New Patch, Alexander Mai, 2002/02/06
- [Freeciv-Dev] Re: New Patch, Raimar Falke, 2002/02/06
- [Freeciv-Dev] Re: New Patch, Alexander Mai, 2002/02/06
- [Freeciv-Dev] Re: New Patch, Raimar Falke, 2002/02/06
- [Freeciv-Dev] Re: New Patch, Alexander Mai, 2002/02/06
- [Freeciv-Dev] Re: New Patch, Raimar Falke, 2002/02/06
- [Freeciv-Dev] Re: New Patch, Tony Stuckey, 2002/02/06
- [Freeciv-Dev] Re: New Patch, Alexander Mai, 2002/02/06
- [Freeciv-Dev] Re: New Patch,
Vasco Alexandre Da Silva Costa <=
- [Freeciv-Dev] Re: New Patch, Alexander Mai, 2002/02/07
- [Freeciv-Dev] Re: New Patch, Ben Webb, 2002/02/06
|
|