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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,139d9b90ab37c0e5 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-11-01 19:44:10 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: dewar@gnat.com (Robert Dewar) Newsgroups: comp.lang.ada Subject: Re: When to do a constraint check and not ?? Date: 1 Nov 2001 19:44:10 -0800 Organization: http://groups.google.com/ Message-ID: <5ee5b646.0111011944.7905d0b3@posting.google.com> References: <3BD91EF8.EEB7EDBA@systems.saab.se> <3BE18C46.1AB713B4@avercom.net> NNTP-Posting-Host: 205.232.38.14 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1004672650 28675 127.0.0.1 (2 Nov 2001 03:44:10 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 2 Nov 2001 03:44:10 GMT Xref: archiver1.google.com comp.lang.ada:15610 Date: 2001-11-02T03:44:10+00:00 List-Id: Tucker Taft wrote in message news:<3BE18C46.1AB713B4@avercom.net>... > Certainly > all compilers will want to believe that "in" and "in out" > parameters are in range, so the (implicit) assignment > from b to the formal parameter p when the function is > called will need to ensure the value is in range. > If it happens to have "stack junk" in it which puts it > outside the typical 0..1 range used for booleans, then > you will get a constraint_error raised here. This is incorrect, it simply describes one possible implementation of the RM rules, there is no specific requirement in the RM that the range check be performed here. Different compilers may (and do) take different viewpoints on when to insert validity checks (to meet the RM requirement that invalid data not cause erroneous execution in most cases). In GNAT Pro, a new switch -gnatV allows detailed control over when validity checks occur, and can be used to force validity checks in many situations where they are not required. We have found this to be a useful debugging aid.