On Wed, 1 Sep 2010 11:18:05 +0400, Dmitry Bely wrote:
> 
> >> Some black magic is needed:
> >>
> >> let r = ref 0.0 in
> >> for i = 0 to 1000_000_000 do r := float i done;
> >> Printf.printf "%f\n" (!r +. 0.);
> >> Printf.printf "words: %f\n" (Gc.stat ()).Gc.minor_words
> 
> Do you have any idea why the optimizer needs that?

It helps the compiler to figure out that “r” must be unboxed.
See also http://caml.inria.fr/mantis/view.php?id=5133

C.

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to