From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c31849ae55c4fb65 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newscon06.news.prodigy.net!prodigy.net!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Strings and errors... (gnat) Date: Wed, 29 Nov 2006 12:44:58 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <1164821430.144822.138100@h54g2000cwb.googlegroups.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls6.std.com 1164822299 27645 192.74.137.71 (29 Nov 2006 17:44:59 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Wed, 29 Nov 2006 17:44:59 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:s/P5baiVJOjeI1xgjIRZNi+JcxY= Xref: g2news2.google.com comp.lang.ada:7746 Date: 2006-11-29T12:44:58-05:00 List-Id: "tr00per" writes: > Hello! > During compilation GNAT says: > pracownicy.adb:123:22: warning: too few elements for subtype of > "Standard.String" defined at line 107 > pracownicy.adb:123:22: warning: "Constraint_Error" will be raised at > run time > (and it is raised at run time) > > Those lines look like that: > ... > 104: buf:string(1..70); > ... > 107: tmp:string(1..30); > ... > 123: tmp:=buf(13..26); > ... > > 123:22 is after := > I don't get the point. Where is the problem? Please help! You can't assign a shorter string into a longer one -- the lengths have to match. You could do: tmp: String := buf(13..26); or tmp: constant String := buf(13..26); and it will take the bounds for tmp from buf(13..26). Or, you could use Unbounded_Strings. - Bob