comp.lang.ada
 help / color / mirror / Atom feed
From: Bill Findlay <news@findlayw.plus.com>
Subject: Syntax of extended return statement
Date: Wed, 16 Mar 2011 00:01:01 +0000
Date: 2011-03-16T00:01:01+00:00	[thread overview]
Message-ID: <C9A5AE3D.82B0%news@findlayw.plus.com> (raw)

I have the following compilation warning from GNAT:

   function pop
   return KDF9.word is
   begin
      the_nest_depth := the_nest_depth - 1;
      return result : KDF9.word := the_nest(the_nest_depth) do
             |
>>> warning: "result" is not modified, could be declared constant
         the_nest(the_nest_depth) := 0;
      end return;
   end pop;

If I change the return statement to:

      return result : constant KDF9.word := the_nest(the_nest_depth) do
         the_nest(the_nest_depth) := 0;
      end return;

it compiles without warning.

My problem is that I see no justification for that in the Ada 2005 RM, which
gives:

extended_return_statement ::=

return defining_identifier:[aliased] return_subtype_indication[:=expression]
[do
   handled_sequence_of_statements
end return]; 

return_subtype_indication ::= subtype_indication | access_definition

Can anyone enlighten me?

-- 
Bill Findlay
with blueyonder.co.uk;
use  surname & forename;





             reply	other threads:[~2011-03-16  0:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-16  0:01 Bill Findlay [this message]
2011-03-16  2:23 ` Syntax of extended return statement Robert A Duff
2011-03-16 17:03   ` Bill Findlay
2011-03-16 10:28 ` Julian Leyh
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox