From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00 autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,fd63afa4dc364b7e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-03-22 06:36:26 PST Path: supernews.google.com!sn-xit-02!supernews.com!news.gv.tsc.tdk.com!falcon.america.net!sunqbc.risq.qc.ca!nntp1.njy.teleglobe.net!teleglobe.net!fr.clara.net!heighliner.fr.clara.net!grolier!newsfeed.planete.net!psinet-france!psiuk-f4!psiuk-p4!uknet!psiuk-n!news.pace.co.uk!nh.pace.co.uk!not-for-mail From: "Marin David Condic" Newsgroups: comp.lang.ada Subject: Re: Implementing C/C++ style #include... Date: Thu, 22 Mar 2001 09:30:33 -0500 Organization: Posted on a server owned by Pace Micro Technology plc Message-ID: <99d2ao$ecu$1@nh.pace.co.uk> References: <98m938$2iod0$1@ID-25716.news.dfncis.de> <3ab9f314.13778993@news.geccs.gecm.com> NNTP-Posting-Host: 136.170.200.133 X-Trace: nh.pace.co.uk 985271448 14750 136.170.200.133 (22 Mar 2001 14:30:48 GMT) X-Complaints-To: newsmaster@pace.co.uk NNTP-Posting-Date: 22 Mar 2001 14:30:48 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Xref: supernews.google.com comp.lang.ada:5992 Date: 2001-03-22T14:30:48+00:00 List-Id: Lots of compilers will optimize away unreachable code thus making some version of: if (True) then Some_Debug_Code; end if ; a useful construct to take the place of preprocessor directives. There are a couple of weaknesses: The most significant is that you can't use this within a declarative part to conditionally create types and objects. The other is that you can't easily toggle it on and off from the compiler command line (or whatever the compiler environment provides.) Still, I think it is a reasonable alternative for most of the things someone wants to build in for debug code. The other alternative being the "pragma Debug" which is more flexible if somewhat less portable. MDC -- Marin David Condic Senior Software Engineer Pace Micro Technology Americas www.pacemicro.com Enabling the digital revolution e-Mail: marin.condic@pacemicro.com Web: http://www.mcondic.com/ "Chris M. Moore" wrote in message news:3ab9f314.13778993@news.geccs.gecm.com... > On Wed, 21 Mar 2001 09:15:14 -0700, "bhazzard" > wrote: > > >A quick question... > > > >Is there any way to implement c/c++ style > >#ifdef pre-processor statements in Ada. > > > >Do Ada compilers have a pre-processor ? > > > >I am using Rational on an Sgi and Green Hills on a Sun... the manual set(s) > >appear to have no reference to such things... This is what I want to do... > >... > >#ifdef TEST_MODE > >#include "test_mode.a > >#endif > >... > >a.make -D TEST_MODE -f *.a > > package Debug is > > type Debug_Mode is (off, minimal, verbose); > > Mode : constant Debug_Mode := Verbose; > > end Debug; > > ... > > with Debug; use Debug; > ... > if Debug.Mode > Minimal then > test_mode.test_code; > end if; > > The compiler should optimise out the debug code when Mode = Off. And > it's portable. > > -- > Chris M. Moore > Software engineer > speaking for myself