caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] caml_alloc_final() user data size - error in doc?
@ 2013-12-17 16:19 Jun Inoue
  0 siblings, 0 replies; only message in thread
From: Jun Inoue @ 2013-12-17 16:19 UTC (permalink / raw)
  To: caml list

Hello, I'm writing a binding for a C library, and I came across this
statement in the manual:

> caml_alloc_final(n, f, used, max) returns a fresh custom block of size n
> words, with finalization function f. The first word is reserved for storing
> the custom operations; the other n-1 words are available for your data.

The implementation of caml_alloc_final(n, f, ...) just calls
caml_alloc_custom(caml_final_custom_operations(f), n * sizeof(value), ...),
but the documentation of the latter function says nothing about the storage
for custom operations, so this doesn't add up.

According to the source code, caml_alloc_final (n, f, ...) seems to
allocate space for n user-defined words, not n-1.  Is this a bug in
the documentation, or is it intended for some reason that
caml_alloc_final() provides only n-1 words of usable storage?

-- 
Jun Inoue

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-12-17 16:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-17 16:19 [Caml-list] caml_alloc_final() user data size - error in doc? Jun Inoue

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).