3 ms·
In mainstream compilers, even on x64, sizeof(long) == sizeof(int). You need long long instead. Of course, in the general case there's exactly zero guarantee tha
by Sharlin 12y ago
In mainstream compilers, even on x64, sizeof(long) == sizeof(int). You need long long instead. Of course, in the general case there's exactly zero guarantee that there even exists an integral type wider than int.
- TwoBit 12y agoThe C99 language standard requires support for long long.
- dezgeg 12y agoBut an implementation where sizeof(int) == sizeof(long) == sizeof(long long) is allowed by the specification.
- marvy 12y agoOn a (slightly) more practical level: there exists some largest integer type. You may someday need to sort it. If you want your sort to always work, you can't afford to overflow.