1

As far as I know the standard says that the size of the short type must be at least 16 bits.

Now I'm wondering if there are actually platforms where shorts are 32 bit or even larger.

I'm aware of stddef.h and that the types defined there should be used if a certain size is required.

Jabberwocky
  • 48,281
  • 17
  • 65
  • 115
  • @EOF related, but not a duplicate. –  Nov 16 '17 at 17:08
  • 3
    @FelixPalmen The bounty'd answer provides an example of an architecture where `CHAR_BIT == 32`. Given that `short` cannot be smaller than `char`, it follows that `short` is 32-bit or larger. – EOF Nov 16 '17 at 17:10
  • @EOF for a duplicate, it's not enough that an answer also answers this question "by accident" -- it must basically ask the same thing. –  Nov 16 '17 at 17:11

2 Answers2

2

Yes. You can find an example here (well, not 32 bit, but "larger than 16"). The example given there is the UNICOS operating system for "Cray" supercomputers, which has 64bit short.

0

IIRC some exotic implementation of C99 above (in/for) Common Lisp (or perhaps only SBCL) has been coded with all of char, short, int being 32 bits exactly.

But I could be wrong.

Basile Starynkevitch
  • 223,805
  • 18
  • 296
  • 547