Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #27402
| From | Eric Sosman <esosman@comcast-dot-net.invalid> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: The Assignment Principle |
| Date | 2014-01-26 15:39 -0500 |
| Organization | A noiseless patient Spider |
| Message-ID | <lc3rpg$814$1@dont-email.me> (permalink) |
| References | <assignment-principle-20140126210852@ram.dialup.fu-berlin.de> |
On 1/26/2014 3:17 PM, Stefan Ram wrote: > 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«.) double x = Double.NaN; assert x == NaN; // ka-BOOM! -- Eric Sosman esosman@comcast-dot-net.invalid
Back to comp.lang.java.programmer | Previous | Next | Find similar | Unroll thread
Re: The Assignment Principle Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-01-26 15:39 -0500
csiph-web