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.8 required=5.0 tests=BAYES_00,INVALID_DATE, MSGID_SHORT autolearn=no autolearn_force=no version=3.4.4 Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!husc6!seismo!rochester!pt.cs.cmu.edu!sei.cmu.edu!firth From: firth@sei.cmu.edu.UUCP Newsgroups: comp.lang.ada Subject: Constrained Boolean Message-ID: <880@aw.sei.cmu.edu.sei.cmu.edu> Date: Tue, 7-Apr-87 09:14:33 EST Article-I.D.: aw.880 Posted: Tue Apr 7 09:14:33 1987 Date-Received: Sat, 18-Apr-87 03:16:10 EST Sender: netnews@sei.cmu.edu Organization: Carnegie-Mellon University, SEI, Pgh, Pa List-Id: Just to correct a couple of minor errors in a previous post If somebody constrains a Boolean subtype to one value, then the following holds . assignments must be checked (but the check is against a single value) . AND and OR need not be checked, assuming the operands are OK . NOT and XOR will always raise CONSTRAINT_ERROR Procedure parameters are passed by value, so the rules for assignment hold. If the variable is an array of constrained Boolean component subtype (phew!) then a component by component check is needed in principle only on assignment of an arbitrary value. It is not needed when the RHS is an expression involving only similarly constrained array values. On many machines, these checks can be subsumed under a block test for (all-zeros) or (all-ones), which are the only legal aggregate values (assuming the array is packed). If the compiler cannot tell whether the Boolean is constrained, then the proper discriminating test is indeed "IF subtype'FIRST /= subtype'LAST". Again, on some machines it might be prudent for the compiler to compute the value of that expression at the point where the subtype is declared.