From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 73887BC37 for ; Fri, 21 Aug 2009 11:39:47 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqADANcHjkqGnQCBXGdsb2JhbACPb4sOFwsICBe7P4QYBQ X-IronPort-AV: E=Sophos;i="4.44,249,1249250400"; d="scan'208";a="34660897" Received: from shiva.jussieu.fr ([134.157.0.129]) by mail1-smtp-roc.national.inria.fr with ESMTP; 21 Aug 2009 11:39:47 +0200 Received: from hydrogene.pps.jussieu.fr (hydrogene.pps.jussieu.fr [134.157.168.1]) by shiva.jussieu.fr (8.14.3/jtpda-5.4) with ESMTP id n7L9dlKm062520 for ; Fri, 21 Aug 2009 11:39:47 +0200 (CEST) X-Ids:165 Received: from hydrogene.pps.jussieu.fr (localhost.localdomain [127.0.0.1]) by hydrogene.pps.jussieu.fr (8.13.4/jtpda-5.4) with ESMTP id n7L9dj1C028129 for ; Fri, 21 Aug 2009 11:39:45 +0200 Received: (from abate@localhost) by hydrogene.pps.jussieu.fr (8.13.4/8.13.2/Submit) id n7L9djV3028128 for caml-list@yquem.inria.fr; Fri, 21 Aug 2009 11:39:45 +0200 Date: Fri, 21 Aug 2009 11:39:45 +0200 From: Pietro Abate To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Conditional compilation Message-ID: <20090821093945.GA27563@uranium.pps.jussieu.fr> References: <4A8A0B3C.10504@gmail.com> <1250562412.6289.8.camel@homesick> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1250562412.6289.8.camel@homesick> X-Operating-System: GNU/Linux User-Agent: Mutt/1.5.9i X-Virus-Scanned: ClamAV 0.94.2/9724/Fri Aug 21 05:27:53 2009 on shiva.jussieu.fr X-Virus-Status: Clean X-Spam: no; 0.00; compilation:01 ifdef:01 foo:01 cpp:01 cpp:01 interprets:01 -pp:01 exited:01 command-line:01 -pp:01 camlp:01 camlp:01 cmo:01 ocaml:01 cmo:01 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 "" # 1 "" # 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