From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 0AC7EBC88 for ; Thu, 3 Feb 2005 13:52:39 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j13CqcLu026769 for ; Thu, 3 Feb 2005 13:52:38 +0100 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 NAA04709 for ; Thu, 3 Feb 2005 13:52:38 +0100 (MET) Received: from [128.93.8.130] (macadam.inria.fr [128.93.8.130]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j13CqcGF002339 for ; Thu, 3 Feb 2005 13:52:38 +0100 Mime-Version: 1.0 (Apple Message framework v619) In-Reply-To: <20050203113155.GA1860@cradle> References: <20050203105826.GA1669@cradle> <20050203.121643.41633039.andrieu@ijm.jussieu.fr> <20050203113155.GA1860@cradle> Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <7B4ADC81-75E2-11D9-866D-000D9345235C@inria.fr> Content-Transfer-Encoding: 7bit From: Damien Doligez Subject: Re: [Caml-list] GC with C issues Date: Thu, 3 Feb 2005 13:52:37 +0100 To: caml users X-Mailer: Apple Mail (2.619) X-Miltered: at concorde with ID 42021E96.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 42021E96.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; damien:01 damien:01 caml-list:01 lineone:01 wrote:01 alloc:01 alloc:01 aligned:01 pointer:01 heap:01 val:01 retval:98 ...:98 ...:98 retval:98 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.2 X-Spam-Level: On Feb 3, 2005, at 12:31, ronniec95@lineone.net wrote: >> Field (retVal, 0) = (value) x; > > Hmm... I thought I was only supposed to do that when using > alloc_small/alloc_shr interface? However using your method does work in > this small example though I'm worried about if something unexpected > will > happen in more 'real-life' code... Since retVal has the "Abstract" tag, its contents is none of the GC's business, so you don't need to use Store_field to tell it about assignments. On the other hand, depending on the bit-pattern of (the value of) x, you might crash the GC if you use Store_field. In this case, x is an aligned pointer outside the heap, so you're safe either way. But the proper way is to store directly with Field. If you want to be pedantic, it's not really a field but a bunch of bytes so the even more proper way is to write: * (someObject *) Bp_val (retVal) = x; -- Damien