From: aho450s AT nic DOT smsu DOT edu (Tony O'Bryan) Newsgroups: comp.os.msdos.djgpp Subject: Re: Weird problem Date: Sat, 15 Mar 1997 13:24:14 GMT Organization: Southwest Missouri State University Lines: 17 Message-ID: <332aa0d0.1431214@ursa.smsu.edu> References: <33287185 DOT 892303 AT news DOT flash DOT net> <33287D83 DOT 63AD AT shoreland DOT com> NNTP-Posting-Host: forseti.i72.smsu.edu To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp On Thu, 13 Mar 1997 16:19:47 -0600, Ray Ratelis 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.