> do weird things to reasonable-looking code, citing "undefined behavior" as an excuse.
If the behaviour is undefined then the code is broken. Programmers need to learn the language instead of putting together hail mary code expecting it to somehow work in spite of the language specifically telling them that they should not expect any defined behavior out of it.
People who whine about undefined behavior are like kids who insist in jamming their fingers in a electric socket and whine when they get a shock.
Re:Declaring C String Constants
by iainmerrick on Tuesday May 30, 2017 @04:28PM
(#14448279)
It would be nice for the compiler to be a friend and ally, rather than a mischievous opponent.
But in the last few years I've read many, many articles about problems that crop up when optimizing C compilers do weird things to reasonable-looking code, citing "undefined behavior" as an excuse. I can't say for sure if I've hit issues like that myself, but I've certainly used libraries that have.
Maybe the problem lies squarely with the compiler vendors, but the language spec enables them.