3 ms·
The compiler is not trying to fix your program. It is just assuming that somehow those lines are never hit, and then is deleting the dead code to make your bina
by plorkyeran 3y ago
The compiler is not trying to fix your program. It is just assuming that somehow those lines are never hit, and then is deleting the dead code to make your binary smaller.
- afiori 3y agoI agree, I was only disagreeing with this view: > > The core concept is that the compiler assumes the program is valid I believe that it is more correct to say that the compiler is unrestricted in what it does with UB, so it handles it in the most convenient way (often toward optimizing binary size, runtime performance, and/or compilation time) By reductio ad absurdum assuming that the program is valid would give the same behaviour. I just believe that it is not what happens operatively.