Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Sign of Integer Operands: int vs unsigned int

Author: Dieter Buerssner

Date: 13:39:17 09/27/03

Go up one level in this thread


On September 27, 2003 at 09:36:00, Russell Reagan wrote:

>typedef int Int32;
>typedef unsigned int UInt32;
>typedef Int32 Int;
>typedef Uint32 UInt;
>
>There are others for 16-bit and 8-bit data. The main advantage is that I can
>switch to a 64-bit platform by changing a line or two of code here
>(specifically, Int and UInt to be 64-bit types).

When you use the library, it might get more complicated. For example, which
function to use for converting text to numerical?

Int32 x = ato?(char *s);

printf, scanf, abs, etc.

I use typedefs only for things, where it could matter for either speed or space
reasons. For example I have 2 move types (that could be the same) - one for
"normal" use (fast) and one for large arrays (small). For anything, where 16 bit
is certainly enough, and one does not care for space, I would use (unsigned)
int.
When not enough - long. An early version of my engine compiled without problem
on Atari and on Alpha and several more.

Regards,
Dieter



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.