Skip to main content
7 events
when toggle format what by license comment
Mar 30, 2017 at 16:48 comment added Jörg W Mittag Found it in C89, too: port70.net/~nsz/c/c89/c89-draft.html#2.2.4.2 Apparently, everything I ever knew about C (which wasn't much to begin with, TBH) was a lie! BTW, I think there's some DSPs where that is actually true.
Mar 30, 2017 at 16:42 comment added John Bode @JörgWMittag: Now, a C implementation where char, short, int, long, and long long are all 64 bits wide would be standards-compliant.
Mar 30, 2017 at 16:39 comment added John Bode @JörgWMittag: No, that's been the case since C89 (don't have a link to that one handy, but the C99 online draft says the same thing).
Mar 30, 2017 at 16:39 comment added Jörg W Mittag Interesting. I guess that's new in C11?
Mar 30, 2017 at 16:37 comment added John Bode @JörgWMittag: C 2011 online draft, 5.2.4.2.1/1: "The values given below shall be replaced by constant expressions suitable for use in #if preprocessing directives ... Their implementation-defined values shall be equal or greater in magnitude (absolute value) to those shown, with the same sign. ... INT_MAX +32767 ... LONG_MAX +2147483647 ... ", etc.
Mar 30, 2017 at 16:29 comment added Jörg W Mittag "For example, the C language standard mandates that an int be able to represent at least the range [-32767...32767], meaning it must be at least 16 bits wide." – Does it? I thought it only guaranteed that a char can hold at least 256 values and that a int may not be smaller than a short, a short not smaller than a byte, and a byte not smaller than a char. A C implementation where char, byte, short, int, log, and long long are all 8 bits is perfectly standards-compliant, at least that's what I thought. The standards lawyers over at Stack Overflow may know more.
Mar 30, 2017 at 16:14 history answered John Bode CC BY-SA 3.0