4 ms·
> One man's "broken code produced by the compiler" is another man's "excellently optimized code by the compiler". To be fair it's not the compiler's fault that
by robinsonb5 3y ago
> One man's "broken code produced by the compiler" is another man's "excellently optimized code by the compiler".
To be fair it's not the compiler's fault that the source program is broken - the argument is over whether the compiler is being helpful or being obtuse, and this particular case I'd argue the latter.
Thanks for the video link - it's an interesting example, but the crucial difference there, I think, is that in that case the compiler isn't doing something counter to the programmer's intent. The code isn't incorrect (assuming a non-pathological buffer size) - it's merely more convenient for the compiler when expressed with int32_t indices rather than uint32_t indices.
I do appreciate, though, that deciding what to yell about and what not to yell about is an extremely non-trivial problem.