At 11:13 PM 13/04/2004 -0700, Doron Rajwan wrote:
>7. The code cannot be changed to (on volatile, it
>could, although not recommended):
> if (hash != 0) return hash;
Yes, but I had to think about this last one for a while.
A nice example of why programmers should stick to writing correctly
synchronized programs. It might be instructional for students to be asked
to attempt to prove correct the naive implementation that uses hash
directly rather than making a copy in h. They would learn something as they
realise that it's not possible, or from understanding why their proof was
invalid.
Sylvia.
-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel
This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:01:04 EDT