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.1 required=5.0 tests=BAYES_00, PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,386228a37afe967f X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-07-21 01:18:48 PST Path: archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!freenix!oleane.net!oleane!nnrp.oleane.net!skymaster!nobody From: "Jean-Pierre Rosen" Newsgroups: comp.lang.ada Subject: Re: Computer Language Shootout Date: Mon, 21 Jul 2003 09:21:45 +0200 Organization: Adalog Message-ID: References: <1ec946d1.0307150715.4ba69f85@posting.google.com> <3F149243.80304@attbi.com> <3F15930C.2070907@attbi.com> NNTP-Posting-Host: mailhost.axlog.fr X-Trace: s1.read.news.oleane.net 1058774509 18146 195.25.228.57 (21 Jul 2003 08:01:49 GMT) X-Complaints-To: abuse@oleane.net NNTP-Posting-Date: Mon, 21 Jul 2003 08:01:49 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Xref: archiver1.google.com comp.lang.ada:40534 Date: 2003-07-21T09:21:45+02:00 List-Id: "Robert Spooner" a �crit dans le message news: bf9crp$18rg$1@f04n12.cac.psu.edu... > I tried this using the following program and gnat version 3.13p on > windows professional 2000 with the following result: > > with Ada.Text_IO; > > procedure No_String_Length_Limit_Test is > > package Tio renames Ada.Text_IO; > > > function Get_Line (Buffer_Size : Positive := 1) return String is > Buffer : String (1..Buffer_Size); > Last : Natural; > begin > Tio.Get_Line (Buffer, Last); > if Last < Buffer'Last then > return Buffer(1..Last); > else > return Buffer & Get_Line (2*Buffer_Size); > end if; > end Get_Line; > > > begin -- No_String_Length_Limit_Test > > loop > Tio.Put ("Enter a message, to exit: "); > declare > The_Message : String := Get_Line; > begin > exit when The_Message'Length = 0; > Tio.Put_Line ("The message is " & The_Message); > end; > end loop; > > end No_String_Length_Limit_Test; > > no_string_length_limit_test.adb:16:26: ambiguous operand for concatenation > no_string_length_limit_test.adb:16:26: possible interpretation at line 8 > Done--error detected. > > Can someone tell me why the operand is ambiguous? > Because there are two possible meanings :-) 1) return the catenation of Buffer with the result of the call to Get_Line with (2*Buffer_Size) as a parameter (what you intended). 2) return the catenation of Buffer with the single character obtained by indexing the result of the call to Get_Line (with the default paramater) by the index value (2*Buffer_Size). No Gnat bug here! -- --------------------------------------------------------- J-P. Rosen (rosen@adalog.fr) Visit Adalog's web site at http://www.adalog.fr