From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 09597BC5A for ; Tue, 11 Apr 2006 11:02:10 +0200 (CEST) Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.206]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id k3B3kOeU001947 for ; Tue, 11 Apr 2006 05:46:24 +0200 Received: by zproxy.gmail.com with SMTP id 13so957584nzp for ; Mon, 10 Apr 2006 20:46:23 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=NVKlkNL7r7oZ8BTiHGdx7lcN6sl4NhC9o23zoyaEGbyzel25k/GlziDaoEkAkiub3+XTnmBs4/1kz2SfeB1duuWiWBydY7kp4yonaV7qvja96fX5sFQg2BRjHzytXLGnEEMpttQx6FL+LHCT3BzIDE+JLBw5i2nb6TW1cNS5YMY= Received: by 10.37.13.77 with SMTP id q77mr1212514nzi; Mon, 10 Apr 2006 20:46:23 -0700 (PDT) Received: by 10.36.121.13 with HTTP; Mon, 10 Apr 2006 20:46:23 -0700 (PDT) Message-ID: Date: Tue, 11 Apr 2006 15:46:23 +1200 From: "Jonathan Roewen" To: "Chris Campbell" Subject: Re: [Caml-list] Converting C arrays to Ocaml arrays Cc: caml-list@yquem.inria.fr In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: X-Miltered: at nez-perce with ID 443B2690.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; arrays:01 ocaml:01 arrays:01 alloc:01 pointer:01 alloc:01 pointer:01 caml-list:01 int:01 caml:02 caml:02 problem:05 converting:05 null:05 depend:07 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_BY_IP autolearn=disabled version=3.0.3 > I believe the array should already be null-terminated. Well, I asked around, and some people say it's not. So, instead, do: calloc(num+1), and then do: array[num] =3D NULL; and null-termination problem will be gone. And looking at caml_alloc_array, the most you'd prolly get is warning about pointer vs int. caml_alloc_array doesn't appear to depend on it being an actual pointer. Jonathan