4 ms·
Could be worse! I vaguely recall a recent C or C++ standard declaring something UB that wasn't UB before. Kinda hard to search for though, so the exact case so
by dale_glass 4y ago
Could be worse!
I vaguely recall a recent C or C++ standard declaring something UB that wasn't UB before. Kinda hard to search for though, so the exact case so far eludes me.
- jcranmer 4y agoIn general, most of the times when something "newly" becomes UB, it was already UB in practice. The most obvious case was the C11/C++11 definition of INT_MIN % -1 to be UB (as everyone tends to implement % as part of a combined / and % instruction, and INT_MIN / -1 is clearly UB).
- m463 4y agowhat happened to: c=-1; ambiguously being either: c = -1; // c becomes -1 or c =- 1; // c decremented by 1
- dale_glass 4y agoWas never a thing? It's: c -= 1; // c decremented by 1 Notice the order is different.
- m463 4y agosorry, it was a longer time ago than I realized: Compound assignment operators of the form =op (such as =-) were changed to the form op= (that is, -=) to remove the semantic ambiguity created by constructs such as i=-10, which had been interpreted as i =- 10 (decrement i by 10) instead of the possibly intended i = -10 (let i be −10). https://en.wikipedia.org/wiki/C_(programming_language)#K&R_C https://en.wikipedia.org/wiki/C_(programming_language)#K&R_C
- taylodl 4y agoYeah - it goes back prior to 1978!