Comment by pinoy420

Comment by pinoy420 a year ago

3 replies

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?

hathawsh a year ago

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.

  • kryptiskt a year ago

    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.