Hacker News new | ask | show | jobs
by Timwi 41 days ago
The statement is valid C#, which has left-to-right execution order and no undefined behavior. The answer is 5 + 7 = 12.
1 comments

Awk also says it's 12.

  awk 'BEGIN{a=5; a = a++ + ++a; print a}'
  12
https://www.gnu.org/software/gawk/manual/gawk.html#index-pre...

"When side effects happen is implementation-defined. In other words, it is up to the particular version of awk."

Android appears to use the One True AWK.

  :/ $ awk 'BEGIN{a=5; a = a++ + ++a; print a}'
  12

  :/ $ which awk
  /system/bin/awk

  :/ $ awk --version
  awk version 20240728