At what point in the loop does integer overflow become undefined behavior?
If you’re interested in a purely theoretical answer, the C++ standard allows undefined behaviour to “time travel”: [intro.execution]/5: A conforming implementation executing a well-formed program shall produce the same observable behavior as one of the possible executions of the corresponding instance of the abstract machine with the same program and the same input. However, if … Read more