comp.lang.ada
 help / color / mirror / Atom feed
From: Philip Anderson <phil.anderson@amsjv.com>
Subject: Re: Some problems with string type
Date: Wed, 06 Jun 2001 17:34:50 +0100
Date: 2001-06-06T17:34:50+01:00	[thread overview]
Message-ID: <3B1E5BAA.49F1EF9B@amsjv.com> (raw)
In-Reply-To: 3B1EE460.D08AD019@wanadoo.fr

Valdes wrote:
> 
> I have my program writen in Ada that raise some exceptions:
> 
> raised CONSTRAINT_ERROR : gestindex.adb:5
> 
> ... And at line 5...
> 
>  function createindex (S:string) return index is
>       I:Index;
>    begin
>       i.nameindex:=s; -- Ligne cinq

Note that Constraint Error will be raised if s is not _exactly_ 20
characters long.

>       i.firstletter:=null;
>       return i;
>    end createindex;
> 
> ... The index record is defined as follow...
> 
>   type index is record
>       nameindex:String(1..20);
>       firstletter:ptrletter;
>    end record;
> 
> ... The mistake seems to be trivial but I don't see it.
> 
> I have seen the same for this also:
> 
>     Ptrtemp.Letter:=Charat(M,Ni);
> 
> there is the same error but Charat return a character and letter is also
> one. (ptrtemp is also type ptrlettre)

Is M a String and Ni an index into it?  If so Ni must be within the
range M'first .. M'last, and M'first may be greater than 1 (and won't be
0).


> All my greetings if you have some ideas. And forgive me for my bad
> english.

Pas de probleme.

> --
> Le Vif Z�phyr Jubile Sur Les Kumquats Du Clown Gracieux.
The quick brown fox jumps over the lazy dog.


-- 
hwyl/cheers,
Philip Anderson
Alenia Marconi Systems
Cwmbr�n, Cymru/Wales



  reply	other threads:[~2001-06-06 16:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-07  2:18 Some problems with string type Valdes
2001-06-06 16:34 ` Philip Anderson [this message]
2001-06-06 20:29   ` Some problems with string type(Exact String?) McDoobie
2001-06-06 21:30     ` tmoran
2001-06-07  8:07       ` Jean-Pierre Rosen
2001-06-06 22:08     ` Marin David Condic
2001-06-07  6:48     ` Ada.Strings.Fixed procedure Move Petter Fryklund
2001-06-07  4:06   ` Some problems with string type Valdes
2001-06-07 13:20     ` Valdes Laurent
2001-06-06 17:49 ` tmoran
2001-06-07  4:07   ` Valdes
replies disabled

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