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,ec21c3c7cdc7ff3e X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.megapath.net!news.megapath.net.POSTED!not-for-mail NNTP-Posting-Date: Fri, 17 Mar 2006 19:17:24 -0600 From: "Randy Brukardt" Newsgroups: comp.lang.ada References: <1142279908.327131.230200@j52g2000cwj.googlegroups.com> Subject: Re: private types Date: Fri, 17 Mar 2006 19:17:32 -0600 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Message-ID: NNTP-Posting-Host: 64.32.209.38 X-Trace: sv3-ifHpZkJIgUpa+tUMjgDxSwK8/IEoRaD+Jybb1ffZlVZbyi++5w+Rtk1o3co99c+vS0CeyE5Wf96wvS1!tflUUgnbH80yvU2TkqZRKcrg3r7jPNH6F/S3APtncKYgjGdZzlpn981DH8OQWHVtlpGMnCg3AuDA!6ItjPS54lvIwKQ== X-Complaints-To: abuse@megapath.net X-DMCA-Complaints-To: abuse@megapath.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news1.google.com comp.lang.ada:3417 Date: 2006-03-17T19:17:32-06:00 List-Id: "Brian May" wrote in message news:sa4hd5x1wgd.fsf@snoopy.microcomaustralia.com.au... ... > For testing the code, as found_it is undefined in the second test, it > is possible it might just fluke the tests you give it and pass > everyone. > > The first code is predictable though, and as long as you give it the > same inputs, it will always produce the same outputs, making it easier > (IMHO) to test. It's not just testing. Ada 95 is very clear that an Ada compiler cannot assume an object is in range unless it can prove it is initialized. Explicit initialization makes this proof trivial (and leaving it out may make it impossible to prove.) 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. Randy.