English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Converting C arrays to Ocaml arrays
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2006-04-11 (09:02)
From: Jonathan Roewen <jonathan.roewen@g...>
Subject: Re: [Caml-list] Converting C arrays to Ocaml arrays
> 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] = 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.