Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #27402 > unrolled thread

Re: The Assignment Principle

Started byEric Sosman <esosman@comcast-dot-net.invalid>
First post2014-01-26 15:39 -0500
Last post2014-01-26 15:39 -0500
Articles 1 — 1 participant

Back to article view | Back to comp.lang.java.programmer

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: The Assignment Principle Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-01-26 15:39 -0500

#27402 — Re: The Assignment Principle

FromEric Sosman <esosman@comcast-dot-net.invalid>
Date2014-01-26 15:39 -0500
SubjectRe: The Assignment Principle
Message-ID<lc3rpg$814$1@dont-email.me>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web