3 ms·
I realize it's there for a reason -- as I understand it, to avoid constraining compilers into generating unnecessarily awkward code for unlikely edge cases. And
by iainmerrick 9y ago
I realize it's there for a reason -- as I understand it, to avoid constraining compilers into generating unnecessarily awkward code for unlikely edge cases. And that fits with one of C's main advantages, being fast and lightweight.
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.
- geezerjay 9y ago> 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.
- iainmerrick 9y agoIt would be nice for the compiler to be a friend and ally, rather than a mischievous opponent.