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 Newsgroups: comp.lang.ada Subject: Re: private types References: <1142279908.327131.230200@j52g2000cwj.googlegroups.com> From: Brian May Date: Fri, 17 Mar 2006 16:17:38 +1100 Message-ID: User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) Cancel-Lock: sha1:OFk8W5pdawzXwBICGScXkQVC/GM= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii NNTP-Posting-Host: snoopy.microcomaustralia.com.au X-Trace: news.melbourne.pipenetworks.com 1142572659 202.173.153.89 (17 Mar 2006 15:17:39 +1000) X-Complaints-To: abuse@pipenetworks.com X-Abuse-Info: Please forward all headers to enable your complaint to be properly processed. Path: g2news1.google.com!news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!news.karotte.org!news.musoftware.de!quokka.wn.com.au!news.melbourne.pipenetworks.com!not-for-mail Xref: g2news1.google.com comp.lang.ada:3394 Date: 2006-03-17T16:17:38+11:00 List-Id: I am not sure how this: function exists return boolean is --Later assignment to found_it is evitable -- found_it : boolean := false; begin if some_precondition then found_it := some_other_condition; end if; return found_it; end exists; Is any better/worse then this: function exists return boolean is --Later assignment to found_it is evitable -- found_it : boolean; begin if some_precondition then found_it := some_other_condition; end if; return found_it; end exists; It is possible a smart compiler might trigger a warning in the second case - but this depends on you noticing the warning and investigating it. There are cases when the compiler might get confused and produce false positives or false negatives. Otherwise, the above problem is a problem that can only be found either by careful inspection of the code or by proper testing. 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. -- Brian May