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.6 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00, HK_RANDOM_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ec21c3c7cdc7ff3e X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news4.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!cyclone1.gnilink.net!spamkiller.gnilink.net!gnilink.net!trnddc04.POSTED!20ae255c!not-for-mail Newsgroups: comp.lang.ada From: Justin Gombos Subject: Re: private types References: <1142279908.327131.230200@j52g2000cwj.googlegroups.com> User-Agent: slrn/0.9.8.1 (Linux) Message-ID: Date: Sat, 18 Mar 2006 02:17:12 GMT NNTP-Posting-Host: 129.44.77.228 X-Complaints-To: abuse@verizon.net X-Trace: trnddc04 1142648232 129.44.77.228 (Fri, 17 Mar 2006 21:17:12 EST) NNTP-Posting-Date: Fri, 17 Mar 2006 21:17:12 EST Xref: g2news1.google.com comp.lang.ada:3421 Date: 2006-03-18T02:17:12+00:00 List-Id: On 2006-03-18, Randy Brukardt wrote: > > Thus, given > A : Positive := 10; > B : Positive; > the compiler can assume that A is in range, potentially being able > to eliminate checks and speeding up the code. But it cannot assume > that B is in range (unless it can prove that it is initialized > further on). > > So I recommend initalizing everything (or assigning it immediately > after the begin) that could be significant to performance. As a rule, I try to put readability ahead of optimizations. But if I did want to write optimum code, I'm not seeing your point here. The runtime checks that might be placed on B need not affect code not handling B. Assuming an extreme case, suppose B is not assigned until 100 lines later (ie not immediately following the begin). There should be no runtime checks in those 100 lines between the 'begin' and the first assignment to B if B is not referenced (and if B is referenced prior to assignment, that's a problem that outweighs excessive checks anyway). The first occurrance of B is going to be an assignment to B, and it must have the same checks that A would have if A were being reassigned at this point. So I'm not seeing why more runtime checks would occur in the case of B. -- PM instructions: do a C4esar Ciph3r on my address; retain punctuation.