Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Olivier Andrieu <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
Date: Fri, 15 Oct 2004 15:45:24 +0200 (CEST)	[thread overview]
Message-ID: <20041015.154524.112630031.andrieu@ijm.jussieu.fr> (raw)
In-Reply-To: <EAF87C98-1EAC-11D9-972F-00039310CAE8@inria.fr>

 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


  reply	other threads:[~2004-10-15 13:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-14 13:23 Bauer, Christoph
2004-10-15 13:20 ` Damien Doligez
2004-10-15 13:45   ` Olivier Andrieu [this message]
2004-10-15 14:49     ` Damien Doligez
2004-10-16 23:56       ` Erik de Castro Lopo
2004-10-15 15:04 ` Xavier Leroy
2004-10-14 14:59 AW: " Bauer, Christoph
2004-10-14 16:19 ` Richard Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041015.154524.112630031.andrieu@ijm.jussieu.fr \
    --to=andrieu@ijm.jussieu.fr \
    --cc=Christoph.Bauer@lms-gmbh.de \
    --cc=caml-list@inria.fr \
    --cc=damien.doligez@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox