comp.lang.ada
 help / color / mirror / Atom feed
From: rgenter@BBN-LABS-B.ARPA
Subject: Re: More fun with public domain Ada
Date: Wed, 29-Jan-86 14:48:49 EST	[thread overview]
Date: Wed Jan 29 14:48:49 1986
Message-ID: <8601300024.AA00511@ucbvax.berkeley.edu> (raw)
In-Reply-To: 8601291840.AA27130@cod.ARPA

In article <8601291840.AA27130@cod.ARPA> David B. Collom 
<sdcsvax!noscvax!collom@ucbvax.berkeley.EDU> 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)

  reply	other threads:[~1986-01-29 19:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1986-01-21  0:26 More fun with public domain Ada Jerry Mungle
1986-01-29 18:40 ` info-ada
1986-01-29 19:48   ` rgenter [this message]
1986-01-30 17:06     ` info-ada
  -- strict thread matches above, loose matches on Subject: below --
1986-01-30 16:53 David B. Collom
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox