Re: short int always 16 bits or not?

Discussion in 'C Programming' started by Eric Sosman, Apr 20, 2013.

  1. Eric Sosman

    Eric Sosman Guest

    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/WG14/www/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_integer#cnote_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
    d
    Eric Sosman, Apr 20, 2013
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Barry Schwarz

    Re: short int always 16 bits or not?

    Barry Schwarz, Apr 20, 2013, in forum: C Programming
    Replies:
    2
    Views:
    195
    glen herrmannsfeldt
    Apr 22, 2013
  2. Shriramana Sharma

    Re: short int always 16 bits or not?

    Shriramana Sharma, Apr 20, 2013, in forum: C Programming
    Replies:
    10
    Views:
    301
    Ken Brody
    Apr 25, 2013
  3. James Kuyper

    Re: short int always 16 bits or not?

    James Kuyper, Apr 20, 2013, in forum: C Programming
    Replies:
    2
    Views:
    177
    James Kuyper
    Apr 22, 2013
  4. Les Cargill

    Re: short int always 16 bits or not?

    Les Cargill, Apr 20, 2013, in forum: C Programming
    Replies:
    0
    Views:
    180
    Les Cargill
    Apr 20, 2013
  5. Keith Thompson

    Re: short int always 16 bits or not?

    Keith Thompson, Apr 20, 2013, in forum: C Programming
    Replies:
    0
    Views:
    185
    Keith Thompson
    Apr 20, 2013
Loading...

Share This Page