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=-2.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,362619d79933f738 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-12-08 15:32:24 PST Path: archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!news-out.visi.com!petbe.visi.com!news.tele.dk!news.tele.dk!small.news.tele.dk!fr.ip.ndsoftware.net!teaser.fr!enst.fr!melchior!cuivre.fr.eu.org!melchior.frmug.org!not-for-mail From: Marius Amado Alves Newsgroups: comp.lang.ada Subject: Re: oo problem help please Date: Mon, 08 Dec 2003 23:19:37 +0000 Organization: Cuivre, Argent, Or Message-ID: References: <4948f537.0312081149.70179416@posting.google.com> NNTP-Posting-Host: lovelace.ada-france.org Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Trace: melchior.cuivre.fr.eu.org 1070925577 43414 80.67.180.195 (8 Dec 2003 23:19:37 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Mon, 8 Dec 2003 23:19:37 +0000 (UTC) To: comp.lang.ada@ada-france.org Return-Path: In-Reply-To: <4948f537.0312081149.70179416@posting.google.com> X-Mailer: Ximian Evolution 1.4.5 X-OriginalArrivalTime: 08 Dec 2003 23:19:28.0623 (UTC) FILETIME=[BA3B0FF0:01C3BDE1] X-Virus-Scanned: by amavisd-new-20030616-p5 (Debian) at ada-france.org X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.3 Precedence: list List-Id: Gateway to the comp.lang.ada Usenet newsgroup List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: archiver1.google.com comp.lang.ada:3248 Date: 2003-12-08T23:19:37+00:00 On Mon, 2003-12-08 at 19:49, shoko wrote: > what is wrong with the following code: > ... > type car is tagged > record > name:String(1..256); > end record; > ... > procedure set_name(name:String;This:in out car)is > begin > this.name:=name; My guess is this last line. > ... the problem is that i get constraint error when the code is executed > why??? Ditto. Possible fixes: - pad (or trim) to 256 before assigning; - make sure the target is initialized to spaces (say), and that the source is no longer than the target, and then write This.Name (1 .. Target'Length) := Name; - redefine the component to be a pointer to string, then write This.Name := new String' (Name);