From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id UAA02793; Fri, 20 Feb 2004 20:50:52 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id UAA03224 for ; Fri, 20 Feb 2004 20:50:50 +0100 (MET) Received: from fichte.ai.univie.ac.at (fichte.ai.univie.ac.at [131.130.174.156]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i1KJonae003828 for ; Fri, 20 Feb 2004 20:50:49 +0100 Received: from fichte.ai.univie.ac.at (markus@localhost [127.0.0.1]) by fichte.ai.univie.ac.at (8.12.3/8.12.3/Debian-6.6) with ESMTP id i1KJofHn023523; Fri, 20 Feb 2004 20:50:41 +0100 Received: (from markus@localhost) by fichte.ai.univie.ac.at (8.12.3/8.12.3/Debian-6.6) id i1KJoe69023522; Fri, 20 Feb 2004 20:50:40 +0100 Date: Fri, 20 Feb 2004 20:50:40 +0100 From: Markus Mottl To: Michael Furr Cc: caml-list@inria.fr Subject: Re: [Caml-list] void/unit in C calls Message-ID: <20040220195040.GA22774@fichte.ai.univie.ac.at> Mail-Followup-To: Michael Furr , caml-list@inria.fr References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.1i X-Miltered: at concorde by Joe's j-chkmail ("http://j-chkmail.ensmp.fr")! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 foo:01 foo:01 val:01 implemented:01 unlikely:02 mottl:02 mottl:02 external:03 worse:03 unit:03 unit:03 wrote:03 markus:04 markus:04 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Fri, 20 Feb 2004, Michael Furr wrote: > I realize this is somewhat of a pedantic question but, what is the proper > prototype for a C function which has a parameter of type unit? > ie: > external foo : unit -> unit = "foo_c" > > should foo_c be declared > void foo_c(void); > or > value foo_c(value); > > Would it ever cause a problem on any architecture if one used the wrong > form? It makes a difference: you should always return Val_unit from unit-functions implemented in C. Otherwise you might find obscure things like: foo () <> () Or worse... - somebody reported to me that he sometimes saw programs crash, though it isn't certain that this was the cause. It shouldn't matter whether you pass void or value to C, I think, unless you want to use the value - which is quite unlikely. Regards, Markus -- Markus Mottl http://www.oefai.at/~markus markus@oefai.at ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners