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 PAA32674; Fri, 15 Oct 2004 15:45:27 +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 PAA32722 for ; Fri, 15 Oct 2004 15:45:26 +0200 (MET DST) Received: from shiva.jussieu.fr (shiva.jussieu.fr [134.157.0.129]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id i9FDjQeX013538; Fri, 15 Oct 2004 15:45:26 +0200 Received: from localhost (akasha.ijm.jussieu.fr [134.157.173.57]) by shiva.jussieu.fr (8.12.11/jtpda-5.4) with ESMTP id i9FDjPdU021495 ; Fri, 15 Oct 2004 15:45:25 +0200 (CEST) X-Ids: 168 Date: Fri, 15 Oct 2004 15:45:24 +0200 (CEST) Message-Id: <20041015.154524.112630031.andrieu@ijm.jussieu.fr> To: damien.doligez@inria.fr Cc: Christoph.Bauer@lms-gmbh.de, caml-list@inria.fr Subject: Re: [Caml-list] OCaml-3.08.1/MinGW: alloc_tuple fails From: Olivier Andrieu In-Reply-To: References: X-Mailer: Mew version 4.0.64 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-1.5.8 (shiva.jussieu.fr [134.157.0.168]); Fri, 15 Oct 2004 15:45:26 +0200 (CEST) X-Miltered: at nez-perce with ID 416FD476.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at shiva.jussieu.fr with ID 416FD475.002 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Antivirus: scanned by sophie at shiva.jussieu.fr X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 mingw:01 alloc:01 andrieu:01 andrieu:01 damien:01 2004:99 bauer:01 camlprim:01 camlparam:01 camllocal:01 alloc:01 val:01 camlreturn:01 val:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Damien Doligez [Fri, 15 Oct 2004]: > On Oct 14, 2004, at 15:23, Bauer, Christoph wrote: > > > CAMLprim value test( value _ ) > > { > >   CAMLparam1( _ ); > >   CAMLlocal1( t ); > >   int i; > >   t = alloc_tuple( 100 ); > >   for( i=0 ; i < 100; ++i ) > >     Store_field( t, i, Int_val ( i )); > >   CAMLreturn ( Val_unit ); > > } > > You are not supposed to use Store_field on a value that is not yet > initialized. You should write this instead: > > caml_initialize (&Field (t, i), Val_int (i)); Hum, doesn't alloc_tuple(n) (which is simply alloc(n, 0)) already initialise the block with zeroes ? -- Olivier ------------------- 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