| 至于C/C ,根据Joshua Bloch/Neal Gafter: "...... In C and C , the order of expression evaluation is not specified. When compiling the expression x ^= expr, many C and C compilers sample the value of x after evaluating expr, which makes the idiom work. Although it may work, it runs afoul of the C/C rule that you must not modify a variable repeatedly between successive sequence points [ISO-C]. Therefore, the behavior of this idiom is undefined even in C and C ....." 而Java/C#则明确规定了表达式中operand的evaluation次序,所以结果不同,起码当前版本是如此 |
| |