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: a07f3367d7,86b57370403509bc X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "(see below)" Newsgroups: comp.lang.ada Subject: Re: Disabling string evaluation in a logging system Date: Wed, 19 May 2010 19:02:26 +0100 Message-ID: References: <5b94cf13-b7e7-4079-97c6-87dd03f29933@o39g2000vbd.googlegroups.com> <3d545554-3182-46df-ab96-0201eac851a9@k31g2000vbu.googlegroups.com> <82bpccz2hr.fsf@stephe-leake.org> <1p3xrphlq60da.1cq62wm0ajal2$.dlg@40tude.net> Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Trace: individual.net KXJpkmCR+3eiXOYiyVyHtA8WIlC9ee66Epj89ye0WUQBDkeiqz Cancel-Lock: sha1:k/BThNvNiQyPQlT3MUzPasj0DiY= User-Agent: Microsoft-Entourage/12.23.0.091001 Thread-Topic: Disabling string evaluation in a logging system Thread-Index: Acr3fXBEpXeQdbxjtEqHbhDhagbrXA== Xref: g2news2.google.com comp.lang.ada:11774 Date: 2010-05-19T19:02:26+01:00 List-Id: On 19/05/2010 13:38, in article 1p3xrphlq60da.1cq62wm0ajal2$.dlg@40tude.net, "Dmitry A. Kazakov" wrote: > On Wed, 19 May 2010 05:04:32 -0400, Stephen Leake wrote: > >> dhenry writes: >> >>> As Dmitry said, the log level may dynamically change. Therefore, >>> inlining in order to let the compiler do the optimization doesn't >>> work. >> >> I don't follow this. Inlining is the same as writing the if-test. > > That depends on the compiler. > > procedure Log (Barrier : Boolean; Message : String) is > begin > if Barrier then > Put (Message); > end if; > end Log; > > can be inlined as: > > 1. moving evaluation of temporaries down: > > declare > Barrier : constant Boolean := ; > begin > if Barrier then > declare > Message : constant String := ; > begin > Put (Message); > end; > end if; > end; > > or as > > 2. moving evaluation of temporaries up: > > declare > Barrier : constant Boolean := ; > Message : constant String := ; > begin > if Barrier then > Put (Message); > end if; > end; > > The language mandates nothing regarding this. The compiler can even ignore > the pragma Inline. I thought the second would be required, to allow side effects to take place as they would normally. -- Bill Findlay chez blueyonder.co.uk