delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/03/03/21:30:25

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
X-Trace-PostClient-IP: 68.147.131.211
From: Brian Inglis <Brian DOT Inglis AT SystematicSw DOT Invalid>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: 16 bit integers
Organization: Systematic Software
Message-ID: <8d4d405go3mm3kvb70drkoat31ukdep52o@4ax.com>
References: <baec0bf0 DOT 0403012323 DOT 10896c3 AT posting DOT google DOT com> <esd840d8dde7matafu4vd11bsvagshadkl AT 4ax DOT com> <baec0bf0 DOT 0403020529 DOT 8f42598 AT posting DOT google DOT com> <Xk01c.25898$aZ3 DOT 23018 AT fed1read04> <4045a682$1 AT news DOT infonet DOT ee>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
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"
<tonu AT ids DOT ee> 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019