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=BAYES_00,TO_NO_BRKTS_FROM_MSSP autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,139d9b90ab37c0e5 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-10-26 07:19:17 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!supernews.com!feed.textport.net!out.nntp.be!propagator-SanJose!in.nntp.be!newsranger.com!www.newsranger.com!not-for-mail Newsgroups: comp.lang.ada From: Ted Dennison References: <3BD91EF8.EEB7EDBA@systems.saab.se> Subject: Re: When to do a constraint check and not ?? Message-ID: <2heC7.1440$xS6.1918@www.newsranger.com> X-Abuse-Info: When contacting newsranger.com regarding abuse please X-Abuse-Info: forward the entire news article including headers or X-Abuse-Info: else we will not be able to process your request X-Complaints-To: abuse@newsranger.com NNTP-Posting-Date: Fri, 26 Oct 2001 10:18:38 EDT Organization: http://www.newsranger.com Date: Fri, 26 Oct 2001 14:18:38 GMT Xref: archiver1.google.com comp.lang.ada:15246 Date: 2001-10-26T14:18:38+00:00 List-Id: In article <3BD91EF8.EEB7EDBA@systems.saab.se>, Per Sandberg says... > >Assume the folowing code: > >procedue bla is > b : boolean; --< B may contain any bit pattern at this point. > > procedure test( p : in out boolean ) is > begin > b := false; > end test; > >begin > test(b); --<< Is the compiler allowed to insert a constraint check on b >here ?? >end; I don't see why it wouldn't be allowed to. It seems quite sensible to want to verify the object before it is read. Reading the variable is what you are saying will happen in your routine when you give the parameter a mode designator of "in". In this example, there's really no reason why your parameter needs to be "in out". Even if you had extra code in there that, say, tried to read "b" later on in "test", you could have used mode "out". The only reason you could possibly need "in out" is if you might want to read the value inside of "test" *before* test writes to it. That would clearly only be valid if a valid value is passed in, and in that case you definitely *want* the constraint check (and probably want it where they placed it). --- T.E.D. homepage - http://www.telepath.com/dennison/Ted/TED.html No trees were killed in the sending of this message. However a large number of electrons were terribly inconvenienced.