From: Oliver Kellogg <okellogg@users.sourceforge.net>
Subject: Re: renaming function result object inside loop
Date: Sun, 6 Sep 2009 13:06:57 +0200
Date: 2009-09-06T13:06:57+02:00 [thread overview]
Message-ID: <h8054g$4mc$03$1@news.t-online.com> (raw)
In-Reply-To: 4aa2a2ed$0$32665$9b4e6d93@newsspool2.arcor-online.net
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
next prev parent reply other threads:[~2009-09-06 11:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-05 17:42 renaming function result object inside loop Georg Bauhaus
[not found] ` <gpidncZaHuLEXT_XnZ2dnUVZ_j-dnZ2d@earthlink.com>
2009-09-05 20:27 ` Georg Bauhaus
2009-09-06 11:06 ` Oliver Kellogg [this message]
2009-09-06 16:03 ` Robert A Duff
2009-09-06 20:09 ` Georg Bauhaus
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox