comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen_leake@acm.org>
To: comp.lang.ada@ada-france.org
Subject: Re: Constraint Error
Date: 29 Sep 2004 20:42:39 -0400
Date: 2004-09-29T20:42:39-04:00	[thread overview]
Message-ID: <mailman.136.1096504969.390.comp.lang.ada@ada-france.org> (raw)
In-Reply-To: <cjfg8e$g6i$00$1@news.t-online.com>

"Rick Santa-Cruz" <rick_santa_cruz75@msn.com> writes:

> Hi,
> 
> how can I avoid the Constraint Error, when executing the following code:
> 
> with Messages;
> 
> procedure Test_Messages is
>  M1: Messages.Message;
>  M2: Messages.Message;
> 
> begin
>  m1:=Messages.Create("This is a test");
>  m2:=Messages.Create("This is a second test");
> end Test_Messages;
> ----------------------------
>  package Messages is
>  type Message is tagged private;
>  subtype String_Txt is String(1..20);

This says that all strings will have exactly 20 characters. Not very
flexible.

See Ada.Strings.Bounded and Ada.Strings.Unbounded, in your favorite
Ada manual or textbook.

-- 
-- Stephe




  parent reply	other threads:[~2004-09-30  0:42 UTC|newest]

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