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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no 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!feeder.news-service.com!ecngs!feeder.ecngs.de!news.k-dsl.de!news.doubleslash.org!open-news-network.org!news.teledata-fn.de!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Disabling string evaluation in a logging system Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <5b94cf13-b7e7-4079-97c6-87dd03f29933@o39g2000vbd.googlegroups.com> <3d545554-3182-46df-ab96-0201eac851a9@k31g2000vbu.googlegroups.com> <82bpccz2hr.fsf@stephe-leake.org> Date: Wed, 19 May 2010 14:38:14 +0200 Message-ID: <1p3xrphlq60da.1cq62wm0ajal2$.dlg@40tude.net> NNTP-Posting-Date: 19 May 2010 14:38:14 CEST NNTP-Posting-Host: ade62eef.newsspool4.arcor-online.net X-Trace: DXC=He_noFQUXcYf8j24CD<3lP4IUK 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. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de