2 ms·
This snippet is not correct: #include <limits.h> #if ULONG_MAX != -1UL #error "This code requires 2s' complement arithmetic" #endif The #error case wi
by caf 8y ago
This snippet is not correct:
#include <limits.h>
#if ULONG_MAX != -1UL
#error "This code requires 2s' complement arithmetic"
#endif
The #error case will never be called, because the behaviour of the unsigned types is completely defined in C - it doesn't matter whether the system uses 2s complement or not, the result of applying the negation operator to 1UL must always be ULONG_MAX.