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=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE 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!ucbvax!info-ada From: rgenter@BBN-LABS-B.ARPA Newsgroups: net.lang.ada Subject: Re: More fun with public domain Ada Message-ID: <8601300024.AA00511@ucbvax.berkeley.edu> Date: Wed, 29-Jan-86 14:48:49 EST Article-I.D.: ucbvax.8601300024.AA00511 Posted: Wed Jan 29 14:48:49 1986 Date-Received: Sat, 1-Feb-86 02:53:21 EST References: <8601291840.AA27130@cod.ARPA> Sender: usenet@ucbvax.BERKELEY.EDU Organization: The ARPA Internet List-Id: In article <8601291840.AA27130@cod.ARPA> David B. Collom writes: > In article <8601210108.AA00678@ucbvax.berkeley.edu> you write: > > > > . . . > > > > One program had the following statement (without the comment!) > > > > LNTH : NATURAL range 1..8 := 0; --whoops, can't count > > > > [ worry that it compiled OK then failed at run time ] > > According to one textbook I have: > > ...there is a general principle that a declaration with > initial value > A: T:=I; > is essentially equivalent to > A: T; > ... > A:=I; > in which the declaration is given without the initial value > and is then followed by an assignment statement. > > [ includes a quote from Section 3.2.1 of the ARM and concludes that Ada > only requires a run-time check, not a compile-time check ] > > David Collom > > (All opinions expressed are my own.) 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 rgenter@labs-b.bbn.COM (Internet new) Cambridge, MA 02238 rgenter@bbn-labs-b.ARPA (Internet old) ...!{decvax,linus}!bbncca!rgenter (UUCP)