Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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.