3 ms·
> Any instance of undefined behavior should result in a Warning, if not an Error. Beyond trivial cases, UB is a runtime behaviour, not compile time. > 'dead c
by gpderetta 7y ago
> Any instance of undefined behavior should result in a Warning, if not an Error.
Beyond trivial cases, UB is a runtime behaviour, not compile time.
> 'dead code paths' should also result in a Warning, if not an Error.
the noise generated would be unbearable.
- icedchai 7y agoMost of the UB people complain about is related to aggressive, compile time optimizations. This may or may not be trivial. Often it isn't, since decades old "working" code can be broken by new compilers. You can argue that the code was always broken, of course.
- gpderetta 7y agoYes, but the way these optimizations work, is not that they detect UB and optimize accordingly, instead they optimize assuming no UB. There is nothing to report at compile time.