Le lundi 08 août 2011 à 10:03 +0200, Guillaume Yziquel a écrit :
> With Val_int, you have an integral value in the tuple's field.
> 
> With caml_copy_nativeint, you have a pointer in the tuple's field.

More explicitly, Val_int creates you a value of type int in the OCaml
world, while caml_copy_nativeint creates you a value of type natint in
the OCaml world. That's why you have two different "functions" in the
first place.

natints (and strings) are allocated blocks in OCaml so you need to copy
the data from the C world to some place in OCaml heap. Hence the
caml_copy_... function. You don not need such function for ints which
are directly stored in the value variable.

Mathias



-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to