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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3b4bed4f74b8ac49 X-Google-Attributes: gid103376,public From: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: GNAT messages and the not operator (pitfall alert!) Date: 1996/10/29 Message-ID: #1/1 X-Deja-AN: 193426829 references: <54snn6$8j5@newsbf02.news.aol.com> organization: New York University newsgroups: comp.lang.ada Date: 1996-10-29T00:00:00+00:00 List-Id: Matthew said Are you sure? My understanding is that "and" and "or" have equal precedence, and that Ada *requires* the use of parens to force to programmer to state his intent. Well I can't really see what sense it makes to say they have the same precedence when they cannot be mixed, but yes indeed, parens are required. Please, please, if you need to leave a loop early, then use "exit when..." or return. I've often seen code (even in software engineering texts that use Ada examples) that sets a loop flag to false, that in turn gets tested at the top of the (while) loop. This is clearly a misuse of the language and a violation of all the principles of programming as a _human_ activity, as you've just doubled the number of states you have to test! This is an arguable point. A loop with a goto that terminates it early (an exit is a form of goto), has the disadvantage that there is no clear precondition for the loop. I am not necessarily disagreeing, just saying that this is a trickier issue that you suggest.