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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,634259facc42df7a X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!tiscali!newsfeed1.ip.tiscali.net!proxad.net!proxad.net!oleane.net!oleane!hunter.axlog.fr!nobody From: Jean-Pierre Rosen Newsgroups: comp.lang.ada Subject: Re: Conditional compilation of debug traces without cpp Date: Wed, 05 Jul 2006 15:03:42 +0200 Organization: Adalog Message-ID: References: <44aaae35$0$5389$626a54ce@news.free.fr> NNTP-Posting-Host: mailhost.axlog.fr Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Trace: s1.news.oleane.net 1152108074 9048 195.25.228.57 (5 Jul 2006 14:01:14 GMT) X-Complaints-To: abuse@oleane.net NNTP-Posting-Date: Wed, 5 Jul 2006 14:01:14 +0000 (UTC) User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) In-Reply-To: <44aaae35$0$5389$626a54ce@news.free.fr> Xref: g2news2.google.com comp.lang.ada:5506 Date: 2006-07-05T15:03:42+02:00 List-Id: guillaume.portail@grospied.enanglais.com a �crit : > package Debug is > procedure Put_Line (M : in String); > end; > > package body Debug is > Enabled : constant Boolean := False; > procedure Put_Line (M : in String) is > begin > if Enabled then > Real_Put_Line (M); > end; > end; > end; Small plug: have a look at package Debug from Adalog's components page (http://www.adalog.fr/compo2.htm), it does this in a very sophistciated way... As for your question: > How may I organize the code to obtain the effect of having Debug.* calls > being nulls when Debug.Enabled is False ? > Name you package Debug_Effective. Then write another package (Debug_Dummy) with the same specification, and where all procedures are null. Then simply compile: with Debug_Effective; package Debug renames Debug_Effective; or: with Debug_Dummy; package Debug renames Debug_Dummy; Switching packages is then not more difficult than changing a #define... -- --------------------------------------------------------- J-P. Rosen (rosen@adalog.fr) Visit Adalog's web site at http://www.adalog.fr