TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy

TEAM-ADA@LISTSERV.ACM.ORG

Options: Use Classic View

Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Content-Type: text/plain; charset="ISO-8859-1"
Sender: "Team Ada: Ada Advocacy Issues (83 & 95)" <[log in to unmask]>
From: "Panfil, Thomas A" <[log in to unmask]>
Date: Wed, 7 Nov 2001 14:06:53 -0500
MIME-Version: 1.0
X-cc: "Panfil, Thomas A. -- IEEE (E-mail)" <[log in to unmask]>, "Thomas A. Panfil (E-mail)" <[log in to unmask]>
Reply-To: "Panfil, Thomas A" <[log in to unmask]>
Parts/Attachments: text/plain (44 lines)
Rick Duley wrote: Tuesday, November 06, 2001 10:49 PM

> Hi teamers,

....

> The idea was that I could increment an integer variable past
> Integer'Last and trap the ensuing uproar, doing something
> useful with it without crashing the program.
> Well, ...that was the idea :(
>
> I am using GNAT 3.13p -- is this a problem with the compiler
> or have I misunderstood the purpose of CONSTRAINT_ERROR all
> these years?  Do I have to do a manual check for run-time
> errors like this or  ......


I think that you set the deep thinkers off onto a sidetrack
here, though it is an interesting and important sidetrack.

Consider the arithmetic in the following disconnected snips
from the sample program:


        --  integer value (Integer'Last) is 2,147,486,647


      Start    : constant Integer := 2_147_483_600;


      for Count in 1 .. 100 loop


            Current : Integer := Start + Count;
                        -- once the value of Count exceeds 47 this
                        --  assignment should (IMHO) raise
                        --  CONSTRAINT_ERROR and drive the point of
                        --  control into the exception handler

The fun should start when Count exceeds 3047, but it never
exceeds 100,  so no fun!! :-(

Tom Panfil -- Baltimore SIGAda

ATOM RSS1 RSS2