3 ms·
My_Favourite_Compiler would compile "x + ++x" as a call to abort(3). I think "undefined behaviour" is a horrible idea.
by cperciva 17y ago
My_Favourite_Compiler would compile "x + ++x" as a call to abort(3). I think "undefined behaviour" is a horrible idea.
- sid0 17y agoI'd go one step further: my favourite compiler would give a compile error on seeing that.
- daeken 17y agoUndefined depends on the language. In many languages, the precedence rules are explicit enough that this code is clearly defined. In Ultilang (my own), Boo, and others, this would be parsed as x + {x += 1; x} and processed left-to-right.
- cperciva 17y agoUndefined depends on the language. Of course. What I didn't mention is that my favourite language is C. :-)