banner
cells

cells

为美好的世界献上 code

Q275

Q275#

#include <iostream>

int main() {
    std::cout << (sizeof(long) > sizeof(int));
}

Answer#

click to see answer The program is unspcified

Explain#

The sizes of the standard integer types are not fixed by the standard. It's perfectly legal to for instance have an implementation where both long and int are 32 bits.

There are five standard signed integer types : “signed char”, “short int”, “int”, “long int”, and “long long int”. In this list, each type provides at least as much storage as those preceding it in the list. (...) Plain ints have the natural size suggested by the architecture of the execution environment 47 ; the other signed integer types are provided to meet special needs.

int must also be large enough to contain any value in the range [INT_MIN, INT_MAX], as defined in the header .

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.