> the article complains that unsigned integer overflow is defined in C while signed integer overflow is not.
The article complains that signed integer overflow is undefined, while unsigned integer overflow is not. There's a difference.
> the Clang team believes this makes loops up to 20% faster
I'd love to see the benchmarks they conducted. Anyway, undefined behaviour was the wrong way to solve the problem. The C language should have grown a `for` loop that's more than a thin veneer of syntax sugar over `while`. Seriously, how hard would the following be?
for (int i = start; end)) {
// body
}
No explicit comparison, evaluate `start` and `end` at the start of the loop, maybe cast them to the type of i, and increment implicitly. While loops can handle the weird cases. There you have your 20%.
The article complains that signed integer overflow is undefined, while unsigned integer overflow is not. There's a difference.
> the Clang team believes this makes loops up to 20% faster
I'd love to see the benchmarks they conducted. Anyway, undefined behaviour was the wrong way to solve the problem. The C language should have grown a `for` loop that's more than a thin veneer of syntax sugar over `while`. Seriously, how hard would the following be?
No explicit comparison, evaluate `start` and `end` at the start of the loop, maybe cast them to the type of i, and increment implicitly. While loops can handle the weird cases. There you have your 20%.