From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id MAA13567; Thu, 3 Jul 2003 12:35:06 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id MAA14205 for ; Thu, 3 Jul 2003 12:35:04 +0200 (MET DST) Received: from mail3.tpgi.com.au ([203.12.160.59]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h63AZ2T29438 for ; Thu, 3 Jul 2003 12:35:03 +0200 (MET DST) Received: from ozemail.com.au (syd-ts18-2600-214.tpgi.com.au [203.58.21.214]) (authenticated (0 bits)) by mail3.tpgi.com.au (8.11.6/8.11.6) with ESMTP id h63AXbW14792; Thu, 3 Jul 2003 20:33:38 +1000 Message-ID: <3F040680.2040808@ozemail.com.au> Date: Thu, 03 Jul 2003 20:33:36 +1000 From: John Max Skaller User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.2.1) Gecko/20010901 X-Accept-Language: en-us MIME-Version: 1.0 To: Neil Conway CC: caml-list@inria.fr Subject: Re: [Caml-list] alloc_final and local value variables References: <10335.207.46.228.14.1057108842.squirrel@mailbox.samurai.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; ozemail:01 caml-list:01 alloc:01 interfacing:01 beginners:01 toxteth:01 glebe:01 2037,:01 9660:01 0850:01 anyhow:01 ocaml:01 caml:01 nsw:01 snail:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Neil Conway wrote: > In Chapter 12 of the O'Reilly book on Ocaml, section "Creating and modifying > Objective CAML values from C", this example code is given for wrapping a > heap-allocated chunk of memory in an Ocaml value: > This code uses a "value" local, but doesn't declare it with one of the > CAMLlocalN variables, as the Ocaml Manual says is necessary (Ocaml Manual, > "Interfacing C with Objective Caml", Section 18.5.1, Rule 2). Is this code > above correct? CAMLlocalN et al are for beginners. They potentially waste time making things roots that don't need to be. Best not to use them, just learn how the collector works .. which you need to interface with it anyhow :-) -- John Max Skaller, mailto:skaller@ozemail.com.au snail:10/1 Toxteth Rd, Glebe, NSW 2037, Australia. voice:61-2-9660-0850 ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners