comp.lang.ada
 help / color / mirror / Atom feed
From: collom%cod@NOSC.ARPA (David B. Collom)
Subject: Re: More fun with public domain Ada
Date: Thu, 30-Jan-86 11:53:58 EST	[thread overview]
Date: Thu Jan 30 11:53:58 1986
Message-ID: <8601301653.AA28491@cod.ARPA> (raw)


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

             reply	other threads:[~1986-01-30 16:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1986-01-30 16:53 David B. Collom [this message]
  -- strict thread matches above, loose matches on Subject: below --
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
1986-01-30 17:06     ` info-ada
replies disabled

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