News for hackers. Stuff that matters.
Re:Why Not Just Do Simple C++ RAII in C? by bregma on Thursday May 23, 2024 @07:08AM (#40453175)
Unsigned integer overflow is not undefined in C or C++. You can rely on how it works.

Signed integer overflow, on the other hand, is undefined. The compiler is allowd to assume it never happens and can re-arrange or eliminate code as it sees fit under that assumption.

How many lines will this code print?

    for (int i = INT_MAX-1; i < 0; ++i) printf("I'm in danger!\n");

There are no comments on this comment yet.