Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] OCaml-3.08.1/MinGW: alloc_tuple fails
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Damien Doligez <damien.doligez@i...>
Subject: Re: [Caml-list] OCaml-3.08.1/MinGW: alloc_tuple fails
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));

-- Damien

-------------------
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