comp.lang.ada
 help / color / mirror / Atom feed
From: Matthew Heaney <matthew_heaney@acm.org>
Subject: Re: Constraint error
Date: 1999/04/07
Date: 1999-04-07T00:00:00+00:00	[thread overview]
Message-ID: <m3d81g1dpl.fsf@mheaney.ni.net> (raw)
In-Reply-To: 370B9398.E10FC47F@rational.com

Nirmala Bhupathi <nbhupath@rational.com> writes:

> I am getting a constraint error with this program.
> Is it behaving right?

Works OK for me.  

What value did you enter to get CE?  Was it negative?  (If so, then that
would explain the error.)



> with Ada.Text_IO;
> with Interfaces;
> 
> procedure Show is
> 
>   type Local_T is mod 32;
> 
>   type Alpha_T   is new Local_T;
>   type Bravo_T   is new Interfaces.Unsigned_32;
>   type Charlie_T is digits 6;
> 
>   package Alpha_IO   is new Ada.Text_IO.Modular_IO(Alpha_T);
>   package Bravo_IO   is new Ada.Text_IO.Modular_IO(Bravo_T);
>   package Charlie_IO is new Ada.Text_IO.Float_IO(Charlie_T);
> 
>   A : Alpha_T;
>   B : Bravo_T;
>   C : Charlie_T;
> 
> begin
> 
>   Ada.Text_IO.Put ("Enter: ");
> 
>   Charlie_IO.Get(C);
> 
>   A := Alpha_T(C);
> 
>   Alpha_IO.Put(A);
> 
>   Ada.Text_IO.New_Line;
> 
>   B := Bravo_T(C);
> 
>   Bravo_IO.Put(B);
> 
>   Ada.Text_IO.New_Line;
> 
> end Show;




  reply	other threads:[~1999-04-07  0:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-04-07  0:00 Constraint error Nirmala Bhupathi
1999-04-07  0:00 ` Matthew Heaney [this message]
1999-04-07  0:00   ` Nirmala Bhupathi
1999-04-08  0:00     ` Matthew Heaney
  -- strict thread matches above, loose matches on Subject: below --
2004-09-29 23:24 Constraint Error Rick Santa-Cruz
2004-09-30  0:42 ` Jeffrey Carter
2004-09-30  0:42 ` Stephen Leake
2004-09-30  1:11 ` tmoran
2004-09-30 13:47 ` John A. S. Rowlands
1987-04-10 21:47 Constraint_Error keith
replies disabled

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