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: 103376,3f73d873d16dcda7,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!news2.volia.net!newsfeed01.sul.t-online.de!t-online.de!news.belwue.de!kanaga.switch.ch!news-zh.switch.ch!switch.ch!cernne03.cern.ch!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Return statements and their scope - guideline Date: Wed, 14 Feb 2007 17:20:33 +0100 Organization: CERN News Message-ID: NNTP-Posting-Host: abpc10883.cern.ch Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit X-Trace: cernne03.cern.ch 1171470033 27299 137.138.37.241 (14 Feb 2007 16:20:33 GMT) X-Complaints-To: news@@cern.ch NNTP-Posting-Date: Wed, 14 Feb 2007 16:20:33 +0000 (UTC) User-Agent: Thunderbird 1.5.0.9 (X11/20061220) Xref: g2news2.google.com comp.lang.ada:9318 Date: 2007-02-14T17:20:33+01:00 List-Id: 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/