News for hackers. Stuff that matters.
Re:In C++, is empty() faster than comparing the size with zero? by TheCoelacanth on Thursday October 28, 2021 @06:10PM (#29032693)
> the compiler cannot assume that adding one will eventually turn negative and then later on reach 0

Signed overflow is undefined behavior, so it is allowed to assume that. It's also allowed to assume anything else that it wants to.

Once you cause a signed overflow, all guarantees are out the window and the compiler can do anything it wants to.

There are no comments on this comment yet.