comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@gnat.com
Subject: Re: Conditional Code in Ada 95?
Date: 1998/08/23
Date: 1998-08-23T00:00:00+00:00	[thread overview]
Message-ID: <6ro33g$kb$1@nnrp1.dejanews.com> (raw)
In-Reply-To: 2$$CdIjQwTPX@nedcu4

In article <2$$CdIjQwTPX@nedcu4>,
  Gautier.DeMontmollin@maths.unine.ch wrote:
> Rex Reges <rex.r.reges@boeing.com> writes:
>
> > I just saw some Ada95 code riddled with conditional
> > compilation statements. I wasn't aware that this
> > was part of Ada95 and I can't find it in the ARM.
>
> Fortunately... The clean (and compatible) way remains
> hardware-specific units when needed and, within an unit,
> constants keys like that:
>
> with text_io; use text_io;
>
> procedure condcomp is
>  debug:   boolean:= false;
>  verbose: boolean:= true;
>  begin
>   if debug then put_line("this is for debug"); end if;
>   if verbose then put_line("verbosity"); end if;
>  end;
>
> Question: which compiler/optimizer will skip the unused
> 'put_line("this is for debug");' ?...
>
> Gautier
>

I would think that virtually any Ada compiler would delete
the dead code if the booleans are constant, but asking for
the deletion in the variable case is a bit more strenuous.
Note that there is absolutely NO reason that these are
variables rather than constants in your example. Remember
an important rule in Ada is that you ALWAYS use the constant
keyword whereever you can.

GNAT will most certainly delete the code in question whether
or not a constant keyword is present.

Robert Dewar
Ada Core Technologies

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum




  reply	other threads:[~1998-08-23  0:00 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-08-21  0:00 Conditional Code in Ada 95? Rex Reges
1998-08-21  0:00 ` Gene Ouye
1998-08-24  0:00   ` Mark A Biggar
1998-08-27  0:00     ` Samuel T. Harris
1998-08-27  0:00       ` David C. Hoos, Sr.
1998-08-22  0:00 ` dewarr
1998-08-22  0:00 ` Gautier.DeMontmollin
1998-08-23  0:00   ` dewar [this message]
1998-08-24  0:00     ` Gautier.DeMontmollin
1998-08-24  0:00   ` Michael F Brenner
1998-08-25  0:00     ` dewarr
1998-08-25  0:00       ` Richard D Riehle
1998-08-26  0:00         ` dennison
1998-08-26  0:00           ` Richard D Riehle
1998-08-27  0:00             ` dennison
1998-08-26  0:00       ` Michael F Brenner
1998-08-25  0:00     ` Jean-Pierre Rosen
1998-08-28  0:00       ` Laurent Pautet
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox