Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* Encoding of (constructor * with * tuple)
@ 2010-07-25 10:53 rixed
  2010-07-25 11:51 ` [Caml-list] " Christophe TROESTLER
  0 siblings, 1 reply; 2+ messages in thread
From: rixed @ 2010-07-25 10:53 UTC (permalink / raw)
  To: caml-list

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 :-) ?


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-07-25 11:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-25 10:53 Encoding of (constructor * with * tuple) rixed
2010-07-25 11:51 ` [Caml-list] " Christophe TROESTLER

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox