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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ec2b9b815bd3b0bd X-Google-Attributes: gid103376,public From: dewar@gnat.com Subject: Re: Conditional Code in Ada 95? Date: 1998/08/23 Message-ID: <6ro33g$kb$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 383803697 References: <35DDFB42.1311@boeing.com> <2$$CdIjQwTPX@nedcu4> Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Sun Aug 23 03:42:40 1998 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/2.02 (OS/2; I) Date: 1998-08-23T00:00:00+00:00 List-Id: In article <2$$CdIjQwTPX@nedcu4>, Gautier.DeMontmollin@maths.unine.ch wrote: > Rex Reges 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