3 ms·
We don't even have to take the speed hit. Why? Because here is how the unspecified evaluation order benefits the above scenario: the compiler doesn't have to re
by kazinator 11y ago
We don't even have to take the speed hit. Why? Because here is how the unspecified evaluation order benefits the above scenario: the compiler doesn't have to reason about whether p == q.
But since C99 we have had a tool by which we can tell the compiler, "trust me, p != q". Namely:
int f(int * restrict p, int * restrict q) { ... }
So with this, even if we have strict left to right order, it can still reorder the code the same as before.