English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
The sharing mechanism in the Marshal module
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-03-07 (14:59)
From: Roland Zumkeller <roland.zumkeller@g...>
Subject: Re: [Caml-list] The sharing mechanism in the Marshal module
On 03/03/07, Deokhwan Kim <dk@ropas.snu.ac.kr> wrote:
> In addtion, what should I do if I really want the sharing of the c
> counter between incr and incr1?

It suffices to define "c" outside of "incr":

let c = ref 0;;

let incr () = c:= !c + 1 ; !c