size guarantee for integral/arithmetic types in C and C++
问题 I know that the C++ standard explicitly guarantees the size of only char , signed char and unsigned char . Also it gives guarantees that, say, short is at least as big as char , int as big as short etc. But no explicit guarantees about absolute value of, say, sizeof(int) . This was the info in my head and I lived happily with it. Some time ago, however, I came across a comment in SO (can't find it) that in C long is guaranteed to be at least 4 bytes, and that requirement is "inherited" by C++