caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jun Inoue <jun.lambda@gmail.com>
To: caml list <caml-list@inria.fr>
Subject: [Caml-list] caml_alloc_final() user data size - error in doc?
Date: Tue, 17 Dec 2013 17:19:44 +0100	[thread overview]
Message-ID: <CA+ZA8QytOz9Zd20bHzOYV2J10qPj_Nyvw8GrGQ2_0P2C-PtgYg@mail.gmail.com> (raw)

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

                 reply	other threads:[~2013-12-17 16:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=CA+ZA8QytOz9Zd20bHzOYV2J10qPj_Nyvw8GrGQ2_0P2C-PtgYg@mail.gmail.com \
    --to=jun.lambda@gmail.com \
    --cc=caml-list@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;
as well as URLs for NNTP newsgroup(s).