3 ms·
A Sufficiently Smart Compiler would be able to. The second just increments a pointer which starts at the first elem of the array; the first increments a counte
by tatterdemalion 9y ago
A Sufficiently Smart Compiler would be able to.
The second just increments a pointer which starts at the first elem of the array; the first increments a counter and then uses it as an offset into the array, which is bounds checked (the second never generates bounds checks). Proving that that counter never exceeds the end of the array, so the bounds check can be dropped, is not trivial.