Path: news.mathworks.com!not-for-mail
From: "James Tursa" <aclassyguy_with_a_k_not_a_c@hotmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: C mex: working with integer mxArrays
Date: Wed, 6 Jan 2010 16:34:05 +0000 (UTC)
Organization: Boeing
Lines: 16
Message-ID: <hi2e1t$g9l$1@fred.mathworks.com>
References: <hi0oe8$g72$1@fred.mathworks.com> <hi1eku$irh$1@fred.mathworks.com> <29108ba0-2da0-4dc7-b3ee-2d896a253e04@k17g2000yqh.googlegroups.com>
Reply-To: "James Tursa" <aclassyguy_with_a_k_not_a_c@hotmail.com>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1262795645 16693 172.30.248.38 (6 Jan 2010 16:34:05 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 6 Jan 2010 16:34:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 756104
Xref: news.mathworks.com comp.soft-sys.matlab:596925

Praetorian <ashish.sadanandan@gmail.com> wrote in message <29108ba0-2da0-4dc7-b3ee-2d896a253e04@k17g2000yqh.googlegroups.com>...
> Here's what the C
> standard says:
> 
> CHAR_BIT (defined in limits.h) is at least 8 bits
> short has a least 16 bits
> int has at least 16 bits
> long has at least 32 bits
> and long long has at least 64 bits.
> 
> So the requirement is "at least", not "is". Also, char <= short <= int
> <= long <= long long, in terms of their sizes.

Not to put too fine a point on it, but the standard is written in terms of min values, not min number of bits. e.g., CHAR_MAX must be at least 127, UCHAR_MAX must be at least 255, etc. Of course, you need at least 8 bits to get these values, so it amounts to the same thing that you have written above. Similar comments for the other integer types.

James Tursa