From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=MSGID_FROM_MTA_HEADER autolearn=disabled version=3.1.3 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 2DA6FBC0B for ; Mon, 15 Jan 2007 23:38:48 +0100 (CET) Received: from sccrmhc13.comcast.net (sccrmhc13.comcast.net [204.127.200.83]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l0FMclCN013656 for ; Mon, 15 Jan 2007 23:38:47 +0100 Message-Id: <200701152238.l0FMclCN013656@concorde.inria.fr> Received: from monkey (c-24-3-185-40.hsd1.pa.comcast.net[24.3.185.40]) by comcast.net (sccrmhc13) with SMTP id <2007011522384401300lt4dhe>; Mon, 15 Jan 2007 22:38:44 +0000 Date: Mon, 15 Jan 2007 18:46:45 -0500 From: Bob Matcuk To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] va_arg values In-Reply-To: <20070115104406.GC12311@furbychan.cocan.org> References: <200701132310.l0DNArug026315@discorde.inria.fr> <20070115104406.GC12311@furbychan.cocan.org> X-Mailer: Sylpheed version 2.2.9 (GTK+ 2.10.6; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-j-chkmail-Score: MSGID : 45AC0277.000 on concorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at concorde with ID 45AC0277.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; camlparam:01 camlreturn:01 cpp:01 camlparam:01 camlreturn:01 allocations:01 malloc:01 ocaml:01 gpg:01 wrote:01 caml-list:01 functions:01 functions:01 macros:01 macros:01 On Mon, 15 Jan 2007 10:44:07 +0000 Richard Jones wrote: > The CAMLparam/CAMLlocal/CAMLreturn/CAMLxparam macros are pretty simple > to understand. I suggest you take some simple code using these > macros, run it through cpp, and have a look at what these macros > actually generate. You will be able to make your own (possibly > non-portable) variations which update caml_local_roots etc. directly. > If that is necessary. Indeed. As I said in my original e-mail, I have already written my own code to do what CAMLparam/CAMLlocal/CAMLxparam do for variable arguments. Basically, well... Lets start with the quickest question to answer: is it even necessary? IF my function is only to be called from other C functions AND if those functions have already properly registered all of the values via CAMLparam/CAMLlocal/CAMLxparam (a safe assumption assuming competent programming) THEN: is it necessary for my function to bother re-registering these values? My guess would be no. Generally, it would seem to me that a function should only have to bother with the CAMLparam/CAMLlocal/CAMLxparam/CAMLreturn stuff if it makes allocations via "caml_" functions (malloc and friends would be safe as they have no hooks into the OCaml GC). Is this true? -- Bob Matcuk http://www.Squeg.Net/ Explanation of My Return Address, GPG Key: http://www.Squeg.Net/returnAddr.php