Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Re: short int always 16 bits or not?

Reply
Thread Tools

Re: short int always 16 bits or not?

 
 
Eric Sosman
Guest
Posts: n/a
 
      04-20-2013
On 4/19/2013 8:14 PM, Shriramana Sharma wrote:
> Hello. I am reading the C99 standard as available from: http://www.open-std.org/jtc1/sc22/WG...docs/n1256.pdf
>
> I note that it specifies (on p 34) macros defining the minimum and maximum values of a short int corresponding to a size of 16 bits. However it doesn't explicitly say that short int-s should be of 16 bits size. So can I trust short int-s to be 16 bits size or not?


From the minimum and maximum values, you can deduce that
`short int' is *at least* sixteen bits wide. But it might be
eighteen bits wide, or twenty-eight, or thirty-two, or ...

> Also, doesn't prescribing #define-s for integer type min/max values conflict with the general (?) understanding that the size of these types are implementation defined? I mean, is the general understanding wrong? (For instance see: http://en.wikipedia.org/wiki/Short_i...e_b_grp_notesc)


Not at all. Something that is "implementation-defined" means
that the implementation must document the definition. Macros like
SHRT_MIN and UINT_MAX are documentation of the implementation's
choices.

> Finally, why would anyone want char to be other than 8 bits? *Is* char on any platform *not* 8 bits?


If I may rephrase your question slightly, you have asked
"لما क्यों किसी को *ी चार अन्य 8 बिट होना चाहेगा". In this form, the
question may well answer itself.

--
Eric Sosman
http://www.velocityreviews.com/forums/(E-Mail Removed)d
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: short int always 16 bits or not? Barry Schwarz C Programming 2 04-22-2013 06:39 PM
shifting bits, shift 32 bits on 32 bit int GGG C++ 10 07-06-2006 06:09 AM
int main(int argc, char *argv[] ) vs int main(int argc, char **argv ) Hal Styli C Programming 14 01-20-2004 10:00 PM
8-Bits vs 12 or 16 bits/pixel; When does more than 8 bits count ? Al Dykes Digital Photography 3 12-29-2003 07:08 PM
dirty stuff: f(int,int) cast to f(struct{int,int}) Schnoffos C Programming 2 06-27-2003 03:13 AM



Advertisments