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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!news-1.dfn.de!news.dfn.de!news.uni-weimar.de!medsec1.medien.uni-weimar.de!lucks From: Stefan.Lucks@uni-weimar.de Newsgroups: comp.lang.ada Subject: Re: Running a preprocessor from GPS? Date: Wed, 29 Jul 2015 09:15:18 +0200 Organization: Bauhaus-Universitaet Weimar Message-ID: References: <1ckwx9hern944$.1w0k6fbvlqo62$.dlg@40tude.net> <1ipfeas9434z5.o8661mp0cpkh.dlg@40tude.net> <75a31df9-801e-4e7f-8e29-403c0650c891@googlegroups.com> NNTP-Posting-Host: medsec1.medien.uni-weimar.de Mime-Version: 1.0 Content-Type: multipart/mixed; BOUNDARY="8323329-524780790-1438153120=:3461" X-Trace: pinkpiglet.scc.uni-weimar.de 1438154659 10098 141.54.178.228 (29 Jul 2015 07:24:19 GMT) X-Complaints-To: news@pinkpiglet.scc.uni-weimar.de NNTP-Posting-Date: Wed, 29 Jul 2015 07:24:19 +0000 (UTC) X-X-Sender: lucks@debian In-Reply-To: <75a31df9-801e-4e7f-8e29-403c0650c891@googlegroups.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) Content-ID: Xref: news.eternal-september.org comp.lang.ada:27114 Date: 2015-07-29T09:15:18+02:00 List-Id: --8323329-524780790-1438153120=:3461 Content-Type: text/plain; CHARSET=ISO-8859-15; FORMAT=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Content-ID: On Tue, 28 Jul 2015, EGarrulo wrote: > On Tuesday, July 28, 2015 at 2:54:50 PM UTC+2, Dmitry A. Kazakov wrote: > >> You can inline the suggested wrapper and hope that the compiler indeed d= oes >> inlining than effectively will make it lazily evaluated. > > I can't understand what you mean here. Would you please explain > further? Thank you. I am not Dmitry, but here is what I frequently do (I actually have a=20 package Debug for that). The declaration is as follows: procedure Trace(Do_It: Boolean; Message: String) with Inline; The implementation is procedure Trace(Do_It: Boolean; Message: String) is begin if Do_It then Ada.Text_IO.Put_Line(Trace_File, Message); end if; end Trace; In your program, you just write Me_Active: Constant Boolean :=3D True; -- change this to False if you don't want to trace Me. Debug.Trace(Me_Active, "Performing Step " & Step(Me)); Now the compiler (well, gnat -- I have no clue what other compilers will=20 do) will first inline the code inside Debug.Trace and, if Active_Me is=20 False, and the function Step has no side effects, the compiler will=20 eliminate the dead code -- at least, if you switch on the optimization. Actually, this is *not* lazy evaluation: If Step has side effects, Ada=20 requires to evaluate it, even if Me_Active is False. A lazy language would= =20 not evaluate Step. But in the given case, who would want to call some=20 function Step with side effects? -------- I love the taste of Cryptanalysis in the morning! -------= - www.uni-weimar.de/de/medien/professuren/mediensicherheit/people/stefan-luck= s ----Stefan.Lucks (at) uni-weimar.de, Bauhaus-Universit=E4t Weimar, Germany-= --- --8323329-524780790-1438153120=:3461--