From: Jean-Christophe Filliatre <Jean-Christophe.Filliatre@lri.fr>
To: Paul Argentoff <argentoff@rtelekom.ru>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Ocaml <-> C
Date: Mon, 18 Apr 2005 13:49:18 +0200 [thread overview]
Message-ID: <16995.40638.509323.719418@gargle.gargle.HOWL> (raw)
In-Reply-To: <86pswscp6t.fsf@paul.rtelekom.ru>
Hello,
Paul Argentoff writes:
>
> Let's say we have a function:
>
> external f : t option -> unit = "c_f"
>
> How can I make analysis depending on the parameter, which in Ocaml is:
>
> match a with
> | None -> chunk1
> | Some x -> chunk2 x
>
> What functions/macros from a standard ocaml includes set can I use?
None is represented by an integer (0) and Some is pointing to a
block. You can test for the former case with the macro Is_long:
if (Is_long(v)) {
... None case ...
} else {
... Some case ...
... you access to x here with Field(v, 0) ...
}
--
Jean-Christophe
next prev parent reply other threads:[~2005-04-18 11:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-18 11:14 Paul Argentoff
2005-04-18 11:49 ` Jean-Christophe Filliatre [this message]
2005-04-18 12:27 ` [Caml-list] " Paul Argentoff
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=16995.40638.509323.719418@gargle.gargle.HOWL \
--to=jean-christophe.filliatre@lri.fr \
--cc=argentoff@rtelekom.ru \
--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