comp.lang.ada
 help / color / mirror / Atom feed
From: Preben Randhol <randhol+abuse@pvv.org>
Subject: Re: FW: Ada 200X
Date: Tue, 3 Jun 2003 14:49:04 +0000 (UTC)
Date: 2003-06-03T14:49:04+00:00	[thread overview]
Message-ID: <slrnbdpdan.87p.randhol+abuse@kiuk0152.chembio.ntnu.no> (raw)
In-Reply-To: mailman.1.1054650999.19078.comp.lang.ada@ada.eu.org

Erlo Haugen wrote:
> Wouldn't
> subtype day_number is natural range 1..31;
> type month_days is array (day_number) of some_other_type;
> 
> eliminate the boundschecking??

Not sure what you mean here.

   procedure testing is
      subtype day_number is natural range 1..31;
      type month_days is array (day_number) of Integer;
      Mai : month_days;
   begin
      Mai (32) := 1;
   end testing;

gnatmake testing.adb 
   gnatgcc -c testing.adb
   testing.adb:6:09: warning: value not in range of type "day_number"
   defined at line 2
   testing.adb:6:09: warning: "constraint_error" will be raised at run time
   gnatbind -x testing.ali
   gnatlink testing.ali


./testing 

raised CONSTRAINT_ERROR : testing.adb:6

-- 
Preben Randhol                    http://www.pvv.org/~randhol/



  reply	other threads:[~2003-06-03 14:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-03 12:13 FW: Ada 200X Erlo Haugen
2003-06-03 14:49 ` Preben Randhol [this message]
2003-06-03 14:55   ` John R. Strohm
2003-06-03 15:16 ` Vinzent Hoefler
replies disabled

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