3 ms·
> UB has nothing to do with optimization. It's about working around the differences between all the platforms that a C program might need to be compiled for. T
by dpc_pw 6y ago
> UB has nothing to do with optimization. It's about working around the differences between all the platforms that a C program might need to be compiled for.
That's what it used to mean. But at some points compilers people decided that since UB means literally "anything can happen" they can make optimizers optimize the shit out of the code assuming that UB can't be there.
C code that used to work 20 years ago, because the UB in it resulted in some weird but non-catastrophic behavior, doesn't work at all compiled modern compilers.