Version française
Home     About     Download     Resources     Contact us    
Browse thread
Question about float refs.
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Christophe TROESTLER <Christophe.Troestler+ocaml@u...>
Subject: Re: [Caml-list] Re: Question about float refs.
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 $B!H(Br$B!I(B must be unboxed.
See also http://caml.inria.fr/mantis/view.php?id=5133

C.