From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 13E8A7EC6E for ; Tue, 17 Dec 2013 17:20:16 +0100 (CET) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of jun.lambda@gmail.com) identity=pra; client-ip=209.85.128.172; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jun.lambda@gmail.com"; x-sender="jun.lambda@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of jun.lambda@gmail.com designates 209.85.128.172 as permitted sender) identity=mailfrom; client-ip=209.85.128.172; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jun.lambda@gmail.com"; x-sender="jun.lambda@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-ve0-f172.google.com) identity=helo; client-ip=209.85.128.172; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jun.lambda@gmail.com"; x-sender="postmaster@mail-ve0-f172.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ai0DAAp5sFLRVYCslGdsb2JhbABZhBeDA7Z8CBYOAQEBAQcLCwkSKoIlAQEEJB0BGx4DAREQDwImAiQBEQEFASKIAgEDCQihb4MGjAdTgwmNLAoZJw1khW8RAQUMgR2NIIM+gUgEmBaKS4VcGCmEWDuBLQ X-IPAS-Result: Ai0DAAp5sFLRVYCslGdsb2JhbABZhBeDA7Z8CBYOAQEBAQcLCwkSKoIlAQEEJB0BGx4DAREQDwImAiQBEQEFASKIAgEDCQihb4MGjAdTgwmNLAoZJw1khW8RAQUMgR2NIIM+gUgEmBaKS4VcGCmEWDuBLQ X-IronPort-AV: E=Sophos;i="4.95,502,1384297200"; d="scan'208";a="49391760" Received: from mail-ve0-f172.google.com ([209.85.128.172]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 17 Dec 2013 17:20:15 +0100 Received: by mail-ve0-f172.google.com with SMTP id jw12so4468045veb.17 for ; Tue, 17 Dec 2013 08:20:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=KrQhmMkdvm2MLxnsR9uG9BR0X7oLZI7ZfyL3vHUJJOY=; b=PZAbAKQUrJ1coGxOs2tWEOUc6wHyZJaW0IkRwODH8osCYAjU5Bk8GjoktSQT+U1v6e 0Kvt38n/koDJ9uLhx470jJM3/y39eiOt7kFGmkSW3kpWpGYkx1971Fd/Ki1cRziDHvPV fW3OX1kScllBAuX00CUTfeNVCx/XwZubBpiuCFHhLHAiI+NUS5Y93JWoj2/9RCLyOkiS INr/sKjJMAbtTkaW1t0rNJzjKXTl6/qN6vHHzAqpA8pswKTWmefoRDdEZ2ZUfz62BCJi FvNaQm3v5b/AEEtBdWe8a6G5PZMUZpKBu8EbS+2y+Ll/qo/qYrFdkwNWnN0EsQGYyq+m lv8Q== X-Received: by 10.52.0.142 with SMTP id 14mr41368vde.94.1387297214551; Tue, 17 Dec 2013 08:20:14 -0800 (PST) MIME-Version: 1.0 Received: by 10.220.159.134 with HTTP; Tue, 17 Dec 2013 08:19:44 -0800 (PST) From: Jun Inoue Date: Tue, 17 Dec 2013 17:19:44 +0100 Message-ID: To: caml list Content-Type: text/plain; charset=UTF-8 Subject: [Caml-list] caml_alloc_final() user data size - error in doc? 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