From: Pietro Abate <Pietro.Abate@pps.jussieu.fr>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Conditional compilation
Date: Fri, 21 Aug 2009 11:39:45 +0200 [thread overview]
Message-ID: <20090821093945.GA27563@uranium.pps.jussieu.fr> (raw)
In-Reply-To: <1250562412.6289.8.camel@homesick>
On Mon, Aug 17, 2009 at 11:26:52PM -0300, Andre Nathan wrote:
> On Mon, 2009-08-17 at 22:00 -0400, Edgar Friendly wrote:
> > Is there a better way to do this? The path I'm following is looking
> > very byzantine compared to C's [-DFOO] + [#ifdef FOO].
> In ospec I use
In my projects I sometimes used directly cpp (Lazy me!). Today I
realized that is not such a good idea cpp interprets c++ comments - like
"\\" - and removes them from your code. For example is you compile the
following empty program with
> ocamlbuild -pp "cpp" test.native
--- test.ml ---
(* http://localhost.org *)
---------------
you will get an error like :
File "test.ml", line 2, characters 5-7:
Error: Comment not terminated
Command exited with code 2.
that is the result of the preprocessing step :
> cpp test.ml
# 1 "test.ml"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "test.ml"
(* http:
------------------
Just to say that "-pp camlp4o Camlp4MacroParser.cmo" is a safer choice
... And maybe I was the only fool using cpp with ocaml ...
>
> -pp "camlp4o Camlp4MacroParser.cmo -D FOO"
>
> which can then be tested in the code with
>
> IFDEF FOO THEN
> ...
> END
>
>
> HTH,
> Andre
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
--
----
http://en.wikipedia.org/wiki/Posting_style
next prev parent reply other threads:[~2009-08-21 9:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-18 2:00 Edgar Friendly
2009-08-18 2:26 ` [Caml-list] " Andre Nathan
2009-08-18 2:37 ` Edgar Friendly
2009-08-18 7:00 ` Olivier Andrieu
2009-08-21 9:39 ` Pietro Abate [this message]
2009-08-18 10:20 ` Richard Jones
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=20090821093945.GA27563@uranium.pps.jussieu.fr \
--to=pietro.abate@pps.jussieu.fr \
--cc=caml-list@yquem.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