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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3885b7fd66a1db28 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-12-23 11:54:21 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!sjc70.webusenet.com!news.webusenet.com!wn12feed!wn13feed!wn14feed!worldnet.att.net!204.127.198.204!attbi_feed4!attbi.com!sccrnsc01.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Why is Ada NOT a good choice for a beginner to programming? References: <3E06EF4A.A72F3B82@t-online.de> X-Newsreader: Tom's custom newsreader Message-ID: NNTP-Posting-Host: 12.234.13.56 X-Complaints-To: abuse@attbi.com X-Trace: sccrnsc01 1040673261 12.234.13.56 (Mon, 23 Dec 2002 19:54:21 GMT) NNTP-Posting-Date: Mon, 23 Dec 2002 19:54:21 GMT Organization: AT&T Broadband Date: Mon, 23 Dec 2002 19:54:21 GMT Xref: archiver1.google.com comp.lang.ada:32251 Date: 2002-12-23T19:54:21+00:00 List-Id: > Sure, but there are some sort of statements where the compiler KNOWS > that there an exception will be raised. So - why not give a warning at > compile time? The Aonix compiler do so!!! Do you think other compilers don't? procedure testerr is a : positive; begin a := 0; end testerr; Gnat testerr.adb:4:08: warning: value not in range of type "Standard.positive" testerr.adb:4:08: warning: "constraint_error" will be raised at run time Aonix testerr.adb: Warning: line 4 col 8 LRM:11.5(17), Value outside range, Constraint_Error will be raised *****Warning: At line 4 in ..\testerr.adb. Constraint_Error will be raised here if executed [value outside range]. Janus In File E:\claw133\finder\TESTERR.ADB at line 4 -------------- 3: begin 4: a := 0; ---------------^ *WARNING* Expression is always out of range (6.5.1) (The Janus manual 6.5.1 says "An expression has an unchanging value that is not within the appropriate range bounds. This will always raise Constraint Error." The Janus error messages have a short sentence, a reference to a short paragraph in the Janus manual, and usually, though not in this case, an ARM reference.) OTOH, none of the three detected at compile time that an exception would be raised by procedure testerr is a : positive := 2; begin for i in 1 .. 2 loop a := a-1; end loop; end testerr;