by chowells · 1y ago · 0 comments
Edit: Just checked in with a C expert. The UB is in the increment operation, so that's not correct after all. You really do just need to separate out the update from the test entirely.
assert(i <= j);
for (;;) {
do_something_with(i);
if (i == j)
break;
i++;
}