Mail Archives: djgpp/1997/03/15/12:59:13
On Thu, 13 Mar 1997 16:19:47 -0600, Ray Ratelis <ray AT shoreland DOT com> wrote:
>It is because in Turbo C++, ints are 2 bytes in size. (int = 16bit,
>short int = 8bit(?))
>In PM, and any other 32bit OS, ints are 4 bytes in size. (int = 32bit =
>long int, short int = 16bit)
I believe that shorts are always guaranteed to be 16 bits, regardless of the
system. Last I heard (I have never actually had access to the ANSI specs, and
had to learn everything through experience and word-of-mouth) integers take on
the size of the machine word of the computer compiling the program (hence 16-bit
DOS has 16-bit integers and GCC has 32-bit integers). That is why the use of
ints hinders portability and the use of shorts and longs are preferred when
numbers need to be in specific ranges supported by those datatypes.
As usual, I am happy to receive insights that reduce my ignorance. :) Please
correct me if I am wrong.
- Raw text -