Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* evaluation order
@ 2009-06-14 16:36 Christophe Raffalli
  2009-06-14 17:45 ` Rémi Vanicat
  2009-06-14 19:40 ` [Caml-list] " Jon Harrop
  0 siblings, 2 replies; 4+ messages in thread
From: Christophe Raffalli @ 2009-06-14 16:36 UTC (permalink / raw)
  To: OCaml


Hello,

In OCaml-3.11.1 (I did not try other version),
the following code print 0 when compiled in bytecode and 1 in nativecode
for obvious reason of different evaluation order in the pair ...


let ptr = ref 0
let fn b =
  if b then incr ptr else decr ptr
let c = fn true, !ptr
let _ = print_int (snd c); print_newline ()

Is any difference between ocamlc and ocamlopt a bug ?

Cheers,
Christophe



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-06-14 21:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-14 16:36 evaluation order Christophe Raffalli
2009-06-14 17:45 ` Rémi Vanicat
2009-06-14 19:40 ` [Caml-list] " Jon Harrop
2009-06-14 21:12   ` Christophe Raffalli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox