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: Cary Jamison Subject: Re: GNAT messages and the not operator (pitfall alert!) Date: 1996/10/28 Message-ID: <3275A12F.B8F@svl.trw.com>#1/1 X-Deja-AN: 193405823 references: content-type: text/plain; charset=us-ascii organization: TRW SIG mime-version: 1.0 newsgroups: comp.lang.ada x-mailer: Mozilla 2.0 (X11; U; SunOS 5.4 sun4m) Date: 1996-10-28T00:00:00+00:00 List-Id: Robert Dewar wrote: [...] RD> Consider this program, which we now, as you see, generate a warning for: RD> RD> 1. with Text_IO; use Text_IO; RD> 2. procedure t1 is RD> 3. type m is mod 256; RD> 4. a : m := 4; RD> 5. b : m := 5; RD> 6. begin RD> 7. if not a < b then RD> | RD> >>> warning: operand of not operator should be parenthesized RD> RD> 8. Put_Line ("this is what I expect"); RD> 9. else RD> 10. Put_Line ("but this is what I get!"); RD> 11. end if; RD> 12. RD> 13. if (not a) < b then RD> 14. Put_Line ("this is not what I expect"); RD> 15. else RD> 16. Put_Line ("this is what I get, and I really asked for it!"); RD> 17. end if; RD> 18. end; RD> RD> I think this warning is quite reasonable, since I would *really* like people RD> to use parens if they really want the situation shown on line 13! But, shouldn't the warning be "not expression should be parenthesized"? I think the "operand of not operator" would just be the 7, i.e. "not (7)" instead of "(not 7)". -- Cary Jamison TRW SIG cary@svl.trw.com