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 VAA03302; Fri, 20 Feb 2004 21:17:04 +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 VAA04541 for ; Fri, 20 Feb 2004 21:17:02 +0100 (MET) Received: from hotmail.com (law10-f31.law10.hotmail.com [64.4.15.31]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i1KKH1ae007745 for ; Fri, 20 Feb 2004 21:17:01 +0100 Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Fri, 20 Feb 2004 12:16:58 -0800 Received: from 64.179.106.232 by lw10fd.law10.hotmail.msn.com with HTTP; Fri, 20 Feb 2004 20:16:58 GMT X-Originating-IP: [64.179.106.232] X-Originating-Email: [lazarus13@hotmail.com] X-Sender: lazarus13@hotmail.com From: "Lars Nilsson" To: caml-list@inria.fr Subject: Re: [Caml-list] void/unit in C calls Date: Fri, 20 Feb 2004 15:16:58 -0500 Mime-Version: 1.0 Content-Type: text/plain; format=flowed Message-ID: X-OriginalArrivalTime: 20 Feb 2004 20:16:58.0577 (UTC) FILETIME=[7E102410:01C3F7EE] 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 val:01 implemented:01 foo:01 foo:01 camlparam:01 camlreturn:01 camlreturn:01 o'caml's:01 premium:99 click:97 imply:02 o'caml:02 worse:03 unit:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk >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. Does this indicate an error in the O'Caml manual, section 18.5.1, where void foo(value v1, value v2, value v3) { CAMLparam3(v1, v2, v3); CAMLreturn0; } is used, in addition to a paragraph preceeding it in the same section saying "If your C function is a procedure you must insert CAMLreturn0 at the end"? In fact, CAMLreturn0 existing at all seems to imply the fact that unit-returning functions (from O'Caml's point of view) can be void in the C implementation. Lars _________________________________________________________________ Say “good-bye” to spam, viruses and pop-ups with MSN Premium -- free trial offer! http://click.atdmt.com/AVE/go/onm00200359ave/direct/01/ ------------------- 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