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: 103376,400766bdbcd86f7c X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news.glorb.com!wns13feed!worldnet.att.net!207.35.177.252!nf3.bellglobal.com!snoopy.risq.qc.ca!newsswitch.lcs.mit.edu!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: This can't be done in Ada...or? Date: 11 Feb 2005 18:52:24 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <1108139611.709714.36170@o13g2000cwo.googlegroups.com> <87fz02k63m.fsf@insalien.org> NNTP-Posting-Host: shell01-e.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1108165944 27591 69.38.147.31 (11 Feb 2005 23:52:24 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Fri, 11 Feb 2005 23:52:24 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: g2news1.google.com comp.lang.ada:8263 Date: 2005-02-11T18:52:24-05:00 List-Id: Ludovic Brenta writes: > Robert A Duff writes: > > 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. > > What if Debug_Info is in a Pure package? Does the compiler still have > to consider possible side effects? No. It's usually a good idea to make things pragma-Pure when possible. Unfortunately, it's not usually possible. The restrictions on pure packages are pretty severe. No access types, for example. And you usually need access types to make complicated data structures. I think Ada 2005 relaxes that restriction. >... I'm really curious. - Bob