home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!dtix!mimsy!alex
- From: alex@cs.umd.edu (Alex Blakemore)
- Newsgroups: comp.lang.ada
- Subject: Re: Mixing logical operators
- Message-ID: <63166@mimsy.umd.edu>
- Date: 5 Jan 93 21:08:56 GMT
- References: <1993Jan5.180216.7426@fcom.cc.utah.edu>
- Sender: news@mimsy.umd.edu
- Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742
- Lines: 18
-
- In article <1993Jan5.180216.7426@fcom.cc.utah.edu> swillden@news.ccutah.edu (Shawn Willden) writes:
- > if i=5 and j=2 or k=3 then
- > the VAX Ada compiler complains that logical operators cannot be intermixed.
- > Is the VAX compiler wrong?
-
- The VAX compiler is correct, as usual.
-
- Parenthesis are required when different logical operators
- appear in the same expression. The LRM expresses this as a
- BNF rule (see 4.4(2)), but its also illustrated
- in the last two examples in 4.4(6).
-
- Its not such a bad rule. The extra parenthesis will help others
- read your code, but I'm glad they didnt extend the idea to arithmetic
- operators (where the precedence conventions are well established).
- --
- ---------------------------------------------------
- Alex Blakemore alex@cs.umd.edu NeXT mail accepted
-