From: Maciej Sobczak <no.spam@no.spam.com>
Subject: Return statements and their scope - guideline
Date: Wed, 14 Feb 2007 17:20:33 +0100
Date: 2007-02-14T17:20:33+01:00 [thread overview]
Message-ID: <eqvcsh$ql3$1@cernne03.cern.ch> (raw)
Hi,
I have found a coding guideline that allows return statements only in
the outermost scope in the subprogram - which is supposed to avoid
obscuring the control flow.
What is outermost scope in this context?
function F return Integer is
begin
if Some_Condition then
return 0; -- (1)
end if;
-- ...
declare
X : Integer;
begin
-- ...
return X; -- (2)
end;
-- ...
return 7; -- (3)
end F;
Is (1) above in the outermost scope?
I understand that (2) is not (and is therefore discouraged) and (3) is
definitely in the outermost scope, but (1) is not very obvious.
--
Maciej Sobczak : http://www.msobczak.com/
Programming : http://www.msobczak.com/prog/
next reply other threads:[~2007-02-14 16:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-14 16:20 Maciej Sobczak [this message]
2007-02-14 16:41 ` Return statements and their scope - guideline Jeffrey R. Carter
2007-02-14 17:31 ` Adam Beneschan
2007-02-15 7:33 ` Maciej Sobczak
2007-02-15 7:37 ` Maciej Sobczak
2007-02-14 16:46 ` Adam Beneschan
2007-02-14 20:06 ` Robert A Duff
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox