@Moon false

because C will be incremented comparison operation completes, not before
@Moon @lanodan the joke is that even if it was c > ++c it would still be false because c is incrementing, not decrementing

equals though is a different story.

at least in JS:

a === ++a
false
a === a++
true

Follow

@hj @lanodan @Moon It's not false or true, it's completely undefined. The rules for sequencing explicitly state that you can only update a variable once between sequence points

The compiler is allowed to read C into register B, then increment C in place, then read C into register A, and then conclude that A > B

· · Web · 2 · 0 · 0
@applejack @hj @lanodan @Moon

JS specifies left to right evaluation order, so:

++x === x // true
x === ++x // false
x++ === x // false
x === x++ // true

But I dunno about C / C++.
Sign in to participate in the conversation
Game Liberty Mastodon

Mainly gaming/nerd instance for people who value free speech. Everyone is welcome.