Comment by pinoy420
6 months ago
Amazing it can do that. How does it work?
That definitely does seem to change its semantics to me. I am not a c expert but this surely has problems the previous one doesn’t?
6 months ago
Amazing it can do that. How does it work?
That definitely does seem to change its semantics to me. I am not a c expert but this surely has problems the previous one doesn’t?
It does change the semantics if n is negative or large enough to cause an overflow. The challenge for the compiler is to somehow prove that neither of those things can happen.
It doesn't have to prove absence of overflow since that is undefined behavior in C and thus modern compilers assume it can never happen.
Great point.