Author: David Rasmussen
Date: 01:20:02 03/20/01
Go up one level in this thread
On March 19, 2001 at 21:48:27, Miguel A. Ballicora wrote: >On March 19, 2001 at 16:07:18, David Rasmussen wrote: > >>On March 19, 2001 at 14:22:20, Miguel A. Ballicora wrote: >> >>>> >>>>An int is assured to be at least 32 bits by the ANSI standard. >>> >>>It is 16, but anyway the problem would be that the standard guarantees "at >>>least" a number (16 for int, 32 for long int). That means that in another >> >>An int with no size modifier is a long int, not a short int, just as it is >>signed if there are no signed/unsigned modifiers. So declaring "int a;" gives a >>variable which is at least 32 bits. > >This is in most of the versions now, but it is not guaranteed but the standard >(1989) > >This is a excerpt from Kernighan & Ritchie (2nd edition) 2.2: > >"short is often 16 bits, long 32 bits, and int either 16 or 32 bits. >Each compiler is free to choose appropiate sizes for its own hardware, subject >only to the restriction that shorts and ints are at least 16 bits, longs are at >least 32 bits, and short is no longer than int, which is no longer than long" > >When it comes to define INT_MAX and INT_MIN in section B11: > >"... The values below are acceptable minimum magnitudes; larger values may be >used" > >INT_MAX +32767 >INT_MIN -32767 > >Which are the values that can be represented in 16 bits >In fact, some compilers in DOS use 16 bit ints. I used one (TURBO C 3.0) >when I started to make my program... >So, this could potentially be in conflict with portability of the opening book. >But I doubt that any modern compiler uses 16 bit ints, but you never know if >you want to port your program to a smaller system... >Maybe this is to theoretical unless you care about true portability. >I care a bit, for other reasons, to learn the details of the language. >On the other hand, I'm lazy :-) Thanks. I knew most of this, but I thought that "int" meant "long int", which it doesn't necesarily. David
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.