From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 22454BBAF for ; Sun, 25 Jul 2010 12:53:43 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AusBAGq0S0zUGyoEkWdsb2JhbACTFYxHFQEBAQEJCwoHEQMfvWSFNgSLMA X-IronPort-AV: E=Sophos;i="4.55,257,1278280800"; d="scan'208";a="56092467" Received: from smtp4-g21.free.fr ([212.27.42.4]) by mail2-smtp-roc.national.inria.fr with ESMTP; 25 Jul 2010 12:53:42 +0200 Received: from acer.happyleptic.org (unknown [82.229.213.209]) by smtp4-g21.free.fr (Postfix) with ESMTP id D5BD34C8083 for ; Sun, 25 Jul 2010 12:53:35 +0200 (CEST) Received: from rixed by acer.happyleptic.org with local (Exim 4.69) (envelope-from ) id 1Ocypr-0001Ff-G2 for caml-list@yquem.inria.fr; Sun, 25 Jul 2010 12:53:35 +0200 Date: Sun, 25 Jul 2010 12:53:35 +0200 From: rixed@happyleptic.org To: caml-list@yquem.inria.fr Subject: Encoding of (constructor * with * tuple) Message-ID: <20100725105332.GA4771@happyleptic.org> Mail-Followup-To: rixed@happyleptic.org, caml-list@yquem.inria.fr MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) X-Spam: no; 0.00; ocaml:01 datatype:01 nativeint:01 bigarray:01 nativeint:01 elt:01 bigarray:01 wosize:01 pointer:01 wosize:01 unboxed:01 integers:01 constructors:01 ocamlc:01 ints:01 Hello list. I'm using ocaml version 3.12.0+beta1, and reading the manual here : http://caml.inria.fr/pub/docs/manual-ocaml/manual032.html#toc130 I have this datatype : type color_specs = Array of vertex_array | Uniq of color where : type color = int * int * int * int type vertex_array = (nativeint, Bigarray.nativeint_elt, Bigarray.c_layout) Bigarray.Array2.t Values of type color_specs are passed to a C function. >>From the manual, I though that the value would be encoded in a block with a tag of 0 (for Array) or 1 (Uniq). If Array, wosize would be 1 and the first and only field would be a pointer to the bigarray, and if Uniq then the wosize would be 4 and the four fields would be the unboxed integers. But apparently I'm wrong since for the Uniq case the wosize is still 1 and the first field points to the tupple of 4 ints which is allocated separately, despite that the manual clearly says : "Non-constant constructors declared with a n-tuple as argument are represented by a block of size n, tagged with the constructor number; the n fields contain the components of its tuple argument." So who's wrong ? ocamlc ? the manual ? or just me :-) ?