The JVM is likely to in-line dummy, realize it does nothing and then
coalesce your other code.

It isn't any wonder that this produces the same results.

On Wed, Nov 16, 2011 at 5:28 AM, Gilles Sadowski <
gil...@harfang.homelinux.org> wrote:

> Besides
>  x + delta - x
> being strange-looking and running the risk of being manually (and
> incorrectly) changed to just
>  delta
> the reference (not) cited above suggests to use a two- or three-steps
> procedure to ensure that some optimizing compiler will not do the same:
> ---CUT---
>  double sum = x + delta;
>  dummy(sum); // function "dummy" does nothing.
>  delta = sum - x;
> ---CUT---
>

Reply via email to