comp.lang.ada
 help / color / mirror / Atom feed
From: alex@MIMSY.CS.UMD.EDU  (Alex Blakemore)
Subject: Re: Mixing logical operators
Date: 5 Jan 93 21:08:56 GMT	[thread overview]
Message-ID: <63166@mimsy.umd.edu> (raw)

In article <1993Jan5.180216.7426@fcom.cc.utah.edu> swillden@news.ccutah.edu (Sh
awn 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

             reply	other threads:[~1993-01-05 21:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-01-05 21:08 Alex Blakemore [this message]
  -- strict thread matches above, loose matches on Subject: below --
1993-01-05 23:15 Mixing logical operators Mark A Biggar
1993-01-05 18:02 agate!dog.ee.lbl.gov!hellgate.utah.edu!fcom.cc.utah.edu!swillden
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox