X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f X-Trace-PostClient-IP: 68.147.131.211 From: Brian Inglis Newsgroups: comp.os.msdos.djgpp Subject: Re: 16 bit integers Organization: Systematic Software Message-ID: <8d4d405go3mm3kvb70drkoat31ukdep52o@4ax.com> References: <4045a682$1 AT news DOT infonet DOT ee> X-Newsreader: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Lines: 26 Date: Thu, 04 Mar 2004 02:21:27 GMT NNTP-Posting-Host: 24.71.223.147 X-Complaints-To: abuse AT shaw DOT ca X-Trace: pd7tw2no 1078366887 24.71.223.147 (Wed, 03 Mar 2004 19:21:27 MST) NNTP-Posting-Date: Wed, 03 Mar 2004 19:21:27 MST To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com On Wed, 3 Mar 2004 11:33:48 +0200 in comp.os.msdos.djgpp, "Tõnu Aas" wrote: >> Use "short"'s instead of Int ( which are really long ). They can be signed >> or unsigned, and are guaranteed >> to be 16 bits > > Use C99 standard stdint.h header and you can control >integer data type sizes in portable way. > > And be warned that there is another thing called alignment >which has not portable way to control. > > Its amazing that C & C++ languages have not instruments to >use even basic data types in portable way. Portable assumptions are: char holds at least 8 bits, int at least 16, long at least 32: pick the appropriate size for the range of integers you have to deal with. Avoid C99 stdint.h if you want to be portable to most existing implementations. -- Thanks. Take care, Brian Inglis Calgary, Alberta, Canada Brian DOT Inglis AT CSi DOT com (Brian dot Inglis at SystematicSw dot ab dot ca) fake address use address above to reply