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: a07f3367d7,c4d1943c804f7cdd X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsmm00.sul.t-online.de!t-online.de!news.t-online.com!not-for-mail From: Oliver Kellogg Newsgroups: comp.lang.ada Subject: Re: renaming function result object inside loop Date: Sun, 6 Sep 2009 13:06:57 +0200 Organization: T-Online Message-ID: References: <4aa2a2ed$0$32665$9b4e6d93@newsspool2.arcor-online.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: news.t-online.com 1252235217 03 n4812 Zyk2QG2l64bTUaa 090906 11:06:57 X-Complaints-To: usenet-abuse@t-online.de X-ID: SXuni4ZCoecOu6Ja2JIxRZ2pK6huibgbeXgoQyCqnTv+1tzef4e-sL User-Agent: Pan/0.133 (House of Butterflies) Xref: g2news2.google.com comp.lang.ada:8192 Date: 2009-09-06T13:06:57+02:00 List-Id: On Sat, 05 Sep 2009 19:42:05 +0200, Georg Bauhaus wrote: > Is the following a spurious warning? > > 528. loop > 529. declare > 530. Line : String renames LIO.Get_Line; --! > | > >>> warning: renaming function result object is suspicious > >>> warning: function "Get_Line" will be called only once > >>> warning: suggest using an initialized constant object > >>> instead > > (Get_Line in fact seems to be called each time around the loop.) I like the compiler's advice. IMHO using a constant here is clearer. For a casual, non-language-lawyer reader of the code, the code may appear to either call the function LIO.Get_Line only once in the elaboration of the renaming declaration, or at each mention of Line. Just my EUR 0.02 Oliver Kellogg