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.1 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,f712c3cc98e7f25,start X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder.news-service.com!newsfeed0.kamp.net!newsfeed.kamp.net!newsfeed.freenet.de!news.tu-darmstadt.de!newsfeed.velia.net!news-fra1.dfn.de!storethat.news.telefonica.de!telefonica.de!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Thu, 15 May 2008 11:19:43 +0200 From: Georg Bauhaus Reply-To: rm.tsho+bauhaus@maps.futureapps.de User-Agent: Thunderbird 2.0.0.14 (X11/20080502) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: not X'Length Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Message-ID: <482c0030$0$7542$9b4e6d93@newsspool1.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 15 May 2008 11:19:44 CEST NNTP-Posting-Host: b619fee7.newsspool1.arcor-online.net X-Trace: DXC=\0O??ZbSUm>85[]]\]T081ic==]BZ:af>4Fo<]lROoR1<`=YMgDjhg2h?n0>]NnbY2PCY\c7>ejV8=b\NSHiG`l1ULK^mhoTa^? X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:70 Date: 2008-05-15T11:19:44+02:00 List-Id: What do you think of the error messages referring to line 9? Does it make sense for a a programmer to expect that a compiler can/should become especially upset when it sees (or maybe, does not see) "not "? Parentheses and "not in" were left out deliberately. procedure B is X: array(1 .. 10) of Boolean; type Gotcha is mod 2**8; begin if X'Length in Positive then null; end if; if not X'Length in Positive then null; end if; if not X'Length in Gotcha then null; end if; if not Natural'(X'Length) in Positive then null; end if; end B; Copyright 1992-2005 Free Software Foundation, Inc. Compiling: b.adb (source file time stamp: 2008-05-15 08:51:18) 1. procedure B is 2. X: array(1 .. 10) of Boolean; 3. type Gotcha is mod 2**8; 4. begin 5. if X'Length in Positive then | >>> warning: condition is always True 6. null; 7. end if; 8. 9. if not X'Length in Positive then | >>> incompatible types 10. null; 11. end if; 12. 13. if not X'Length in Gotcha then 1 2 >>> warning: not expression should be parenthesized here >>> warning: condition is always True 14. null; 15. end if; 16. 17. if not Natural'(X'Length) in Positive then | >>> operator "Not" not defined for type "Standard.Natural" 18. null; 19. end if; 20. end B; 20 lines: 2 errors, 3 warnings gnatmake: "b.adb" compilation error ---8<---8<---8<--- Copyright (c) 1994-2006, SofCheck, Inc. All Rights Reserved. Compiling 'b.adb': Thu May 15 10:59:19 2008 Source file: b.adb Thu May 15 11:08:34 2008 1 procedure B is 2 X: array(1 .. 10) of Boolean; 3 type Gotcha is mod 2**8; 4 begin 5 if X'Length in Positive then 6 null; 7 end if; 8 9 if not X'Length in Positive then * *****Error: LRM:8.6(28) Inappropriate operands for "IN" operation, continuing 10 null; 11 end if; 12 13 if not X'Length in Gotcha then 14 null; 15 end if; 16 17 if not Natural'(X'Length) in Positive then * *****Error: LRM:8.4(1) Unary operator "NOT" on Integer not directly visible, ***** use clause or conversion might be needed 18 null; 19 end if; 20 end B;