S
Stefan Ram
I once read the »Assignment Principle«. It says that after
an assignment a comparison with the assigned value yields
true. Assuming v was declared properly:
v = 2;
java.lang.System.out.println( v == 2 ); // prints true
I think we can assume a single thread of execution and
normal memory [not I/O registers or so]. Also, it is
about values and not expressions, so that
v = java.lang.Math.random();
java.lang.System.out.println( v == java.lang.Math.random() );
is not a counterexample.
Being cautious, I'd like to ask: Do you see any exceptions,
where this does not hold? (I suggest to reply only if the
answer to that question is »yes«.)
an assignment a comparison with the assigned value yields
true. Assuming v was declared properly:
v = 2;
java.lang.System.out.println( v == 2 ); // prints true
I think we can assume a single thread of execution and
normal memory [not I/O registers or so]. Also, it is
about values and not expressions, so that
v = java.lang.Math.random();
java.lang.System.out.println( v == java.lang.Math.random() );
is not a counterexample.
Being cautious, I'd like to ask: Do you see any exceptions,
where this does not hold? (I suggest to reply only if the
answer to that question is »yes«.)