home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / ada / 3885 < prev    next >
Encoding:
Internet Message Format  |  1993-01-05  |  1.1 KB

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