From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 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 5F2E8BC6C for ; Thu, 17 Jan 2008 19:32:21 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAACsuj0fAXQInh2dsb2JhbACQFwEBAQgKKYEUnBU X-IronPort-AV: E=Sophos;i="4.24,303,1196636400"; d="scan'208";a="6240645" Received: from concorde.inria.fr ([192.93.2.39]) by mail2-smtp-roc.national.inria.fr with ESMTP; 17 Jan 2008 19:32:20 +0100 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id m0HIWKYP013642 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Thu, 17 Jan 2008 19:32:21 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAACsuj0fAbSoIh2dsb2JhbACQFwEBAQgKKYEUnBU X-IronPort-AV: E=Sophos;i="4.24,303,1196636400"; d="scan'208";a="6863170" Received: from einhorn.in-berlin.de ([192.109.42.8]) by mail1-smtp-roc.national.inria.fr with ESMTP; 17 Jan 2008 19:32:20 +0100 X-Envelope-From: oliver@first.in-berlin.de X-Envelope-To: Received: from einhorn.in-berlin.de (localhost [127.0.0.1]) by einhorn.in-berlin.de (8.13.6/8.13.6/Debian-1) with ESMTP id m0HIWJ1c008851 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Thu, 17 Jan 2008 19:32:19 +0100 Received: (from www-data@localhost) by einhorn.in-berlin.de (8.13.6/8.13.6/Submit) id m0HIWJgS008845 for caml-list@inria.fr; Thu, 17 Jan 2008 19:32:19 +0100 X-Authentication-Warning: einhorn.in-berlin.de: www-data set sender to oliver@first.in-berlin.de using -f Received: from dslb-088-073-099-097.pools.arcor-ip.net (dslb-088-073-099-097.pools.arcor-ip.net [88.73.99.97]) by webmail.in-berlin.de (IMP) with HTTP for ; Thu, 17 Jan 2008 19:32:19 +0100 Message-ID: <1200594739.478f9f33aa51f@webmail.in-berlin.de> Date: Thu, 17 Jan 2008 19:32:19 +0100 From: Oliver Bandel To: caml-list@inria.fr Subject: Re: [Caml-list] Give back a Pair from C to OCaml? References: <1200583973.478f7525e7a5a@webmail.in-berlin.de> <9d3ec8300801170743k509a7c4wa9d8f490118a9653@mail.gmail.com> In-Reply-To: <9d3ec8300801170743k509a7c4wa9d8f490118a9653@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.6 X-Scanned-By: MIMEDefang_at_IN-Berlin_e.V. on 192.109.42.8 X-Miltered: at concorde with ID 478F9F34.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; bandel:01 in-berlin:01 ocaml:01 pointers:01 ocaml:01 integers:01 camlprim:01 camlprim:01 oreilly-book:01 gcc:01 -wall:01 int's:01 unboxed:01 .....:98 oliver:01 Zitat von Till Varoquaux : > from the manual: > > >>Tuples are represented by pointers to blocks, with tag 0. > > You have to create a block with two fields and put each integer in > one > of these fields (ocaml integers that is). I can't tell you exactly > from the top of my head but I do rememenber it isn't really hard. [...] I only have seen so much different docs about that topic. For example OCaml-book from OReilly writes other things then I found at other places. But it doesn't matter what the OCaml-book says, only the reference manual does count. But the reference manual is not an introductional text, and so I may have to reread it to understand it. For example I can use "CAMLprim value (.....){...}" or I can throw out "CAMLprim" (which is, what I found in the OReilly-book). Also "value x" or "int x" are working as C-parameters of a function. But an OCaml-int is not the same like a C-int, so I would expect gcc throw out at least a warning. I have added "-Wall", but no warning there. Possibly that's because what is mentioned in "18.2", that int's are "value". But there is no distinction between the OCaml-ints and the machine's C-ints in that text. Is "an unboxed integer" meant to be a machine's native int, 32 Bits or 64 Bits, depending on the machine?. Can it be given as parameter and return value as it is? At least the missing compiler-warnings seem to say me that. Possibly I should read the reference manual in more detail but possibly someone sees, what I have overseen...?! Ciao, Oliver