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=-2.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Thread: 103376,400766bdbcd86f7c X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!proxad.net!usenet-fr.net!enst.fr!melchior!cuivre.fr.eu.org!melchior.frmug.org!not-for-mail From: Duncan Sands Newsgroups: comp.lang.ada Subject: Re: This can't be done in Ada...or? Date: Sat, 12 Feb 2005 14:55:12 +0100 Organization: Cuivre, Argent, Or Message-ID: References: <1108139611.709714.36170@o13g2000cwo.googlegroups.com> NNTP-Posting-Host: lovelace.ada-france.org Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Trace: melchior.cuivre.fr.eu.org 1108216527 1504 212.85.156.195 (12 Feb 2005 13:55:27 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Sat, 12 Feb 2005 13:55:27 +0000 (UTC) Cc: comp.lang.ada@ada-france.org To: Robert A Duff Return-Path: In-Reply-To: X-Mailer: Evolution 2.0.2 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at ada-france.org X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Gateway to the comp.lang.ada Usenet newsgroup" List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: g2news1.google.com comp.lang.ada:8278 Date: 2005-02-12T14:55:12+01:00 > The compiler can optimize away everything inside the "if > Logging_Enabled". But it can't optimize away the evaluation of the > parameters unless it can prove the absence of side effects. > For example: > > Trace.Error(..., "Bad value of X " & Debug_Info(X)); > > where Debug_Info is some user-defined function that produces useful > debug info about some complicated data structure called X. > It has no side effects, but the compiler doesn't know that, usually. GNAT's pragma Pure_Function might help here. Is something like that planned for Ada 2005? All the best, Duncan.