caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Lars Nilsson" <lazarus13@hotmail.com>
To: caml-list@inria.fr
Subject: Re: [Caml-list] void/unit in C calls
Date: Fri, 20 Feb 2004 15:16:58 -0500	[thread overview]
Message-ID: <LAW10-F31RM4vNQXzkN000550b6@hotmail.com> (raw)

>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


             reply	other threads:[~2004-02-20 20:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-20 20:16 Lars Nilsson [this message]
2004-02-20 20:36 ` [Caml-list] " Jed Davis
  -- strict thread matches above, loose matches on Subject: below --
2004-02-20 19:26 [Caml-list] " Michael Furr
2004-02-20 19:41 ` Shawn Wagner
2004-02-20 19:50 ` Markus Mottl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=LAW10-F31RM4vNQXzkN000550b6@hotmail.com \
    --to=lazarus13@hotmail.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).