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.6 required=5.0 tests=BAYES_00,INVALID_DATE, TO_NO_BRKTS_PCNT autolearn=no autolearn_force=no version=3.4.4 Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site ucbvax.BERKELEY.EDU Path: utzoo!watmath!clyde!burl!ulysses!gamma!epsilon!zeta!sabre!petrus!bellcore!decvax!ittatc!dcdwest!sdcsvax!ucbvax!info-ada From: collom%cod@NOSC.ARPA (David B. Collom) Newsgroups: net.lang.ada Subject: Re: More fun with public domain Ada Message-ID: <8601301653.AA28491@cod.ARPA> Date: Thu, 30-Jan-86 11:53:58 EST Article-I.D.: cod.8601301653.AA28491 Posted: Thu Jan 30 11:53:58 1986 Date-Received: Sat, 1-Feb-86 06:51:18 EST Sender: dma@ucbvax.BERKELEY.EDU Organization: The ARPA Internet List-Id: Rick, You write: >Perhaps the ARM doesn't *require* that compile-time checking be performed, >but I would certainly hope that > > Lnth: NATURAL range 1..8; > > Lnth := 0; > >would be caught at compile-time. It doesn't take a whole lot more intelligence >to figure out that the above is invalid, given that the following is also >invalid (and *is* a compile-time error even in the ARM): > > Lnth := 1.5; -------- Rick Genter BBN Laboratories Inc. (617) 497-3848 10 Moulton St. 6/506 Two points must be made here. The first is a minor point; note that "Lnth := 1.5;" is a compile-time error because the two sides of the assignment operation are of different sub-types, not because of range checking. The second is that you are, indeed right about 'hoping' that the compiler could check for the CONSTRAINT_ERROR. (Note that the article to which I was replying regarded the DEC Ada compiler, and I was simply making the point that that compiler was not violating the AJPO requirements.) Indeed, the DEC Ada compiler DOES check for this error and reports it as a warning. If you look at the .LIS file which is generated by the compiler you will find that it contains a warning to the effect that a CONSTRAINT_ERROR will be raised when the program is run. Note the following fragment of the file TESTTEST.LIS which is generated by the DEC Ada compiler: -------------------------------------------------------------------------------- TESTTEST 30-Jan-1986 08:21:42 VAX Ada V1.1-10 Page 1 01 30-Jan-1986 08:20:14 DUA1:[COLLOM.ADA]TESTTEST.ADA;1 (1) 1 procedure TESTTEST is 2 LNTH : NATURAL range 1..8 := 0; ............1 %ADAC-I-CONSTRAINT_ERRO, (1) CONSTRAINT_ERROR will be raised here if executed 3 begin 4 null; 5 end; PSECT MAP Psect Hex Size Dec Size Name 0 0000000C 12 TESTTEST.$CODE %ADAC-I-CL_ADDED, Procedure body TESTTEST added to library TESTTEST 30-Jan-1986 08:21:42 VAX Ada V1.1-10 Page 2 01 Ada Compilation Statistics 30-Jan-1986 08:20:14 DUA1:[COLLOM.ADA]TESTTEST.ADA;1 (1) . . . COMPILATION STATISTICS Weak warnings: 1 Warnings: 0 Errors: 0 Peak working set: 1200 Virtual pages used: 5342 Virtual pages free: 38658 CPU Time: 00:00:01.47 (204 Lines/Minute) Elapsed Time: 00:00:04.60 Compilation Complete -------------------------------------------------------------------------------- Hope this helps, David B. Collom