Velocity Reviews

Velocity Reviews (
-   C Programming (
-   -   Re: short int always 16 bits or not? (

Les Cargill 04-20-2013 05:24 AM

Re: short int always 16 bits or not?
Shriramana Sharma wrote:
> Hello. I am reading the C99 standard as available from:
> 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?

No, not really. You have to verify this. This being said,
it's true for a vast majority of platforms.

> 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:

Supposedly, said macros would be adapted to be platform specific.

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

We can't say in general. It's a heck of a founding assumption
to give up, so hopefully there's a good reason.

> Thanks.

Les Cargill

All times are GMT. The time now is 02:00 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.