From: "(see below)" <yaldnif.w@blueyonder.co.uk>
Subject: Re: Disabling string evaluation in a logging system
Date: Wed, 19 May 2010 19:02:26 +0100
Date: 2010-05-19T19:02:26+01:00 [thread overview]
Message-ID: <C819E642.143C31%yaldnif.w@blueyonder.co.uk> (raw)
In-Reply-To: 1p3xrphlq60da.1cq62wm0ajal2$.dlg@40tude.net
On 19/05/2010 13:38, in article 1p3xrphlq60da.1cq62wm0ajal2$.dlg@40tude.net,
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote:
> On Wed, 19 May 2010 05:04:32 -0400, Stephen Leake wrote:
>
>> dhenry <tfc.duke@gmail.com> 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 := <condition-expression>;
> begin
> if Barrier then
> declare
> Message : constant String := <message-expression>;
> begin
> Put (Message);
> end;
> end if;
> end;
>
> or as
>
> 2. moving evaluation of temporaries up:
>
> declare
> Barrier : constant Boolean := <condition-expression>;
> Message : constant String := <message-expression>;
> 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
<surname><forename> chez blueyonder.co.uk
next prev parent reply other threads:[~2010-05-19 18:02 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-18 7:48 Disabling string evaluation in a logging system dhenry
2010-05-18 8:15 ` Dmitry A. Kazakov
2010-05-18 8:45 ` Dmitry A. Kazakov
2010-05-18 9:45 ` Cyrille
2010-05-18 10:26 ` Dmitry A. Kazakov
2010-05-18 12:10 ` Georg Bauhaus
2010-05-18 12:15 ` Georg Bauhaus
2010-05-18 12:54 ` Dmitry A. Kazakov
2010-05-18 9:32 ` Gautier write-only
2010-05-18 9:37 ` Gautier write-only
2010-05-18 11:27 ` Gautier write-only
2010-05-18 12:18 ` dhenry
2010-05-19 9:04 ` Stephen Leake
2010-05-19 12:38 ` Dmitry A. Kazakov
2010-05-19 18:02 ` (see below) [this message]
2010-05-19 19:08 ` Adam Beneschan
2010-05-18 10:13 ` stefan-lucks
2010-05-18 18:17 ` Jeffrey R. Carter
2010-05-18 18:40 ` tmoran
2010-05-19 7:47 ` dhenry
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox