From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.0 required=3.0 tests=BAYES_40 autolearn=ham autolearn_force=no version=3.4.5-pre1 X-Received: by 2002:a37:a54f:: with SMTP id o76mr26870382qke.95.1615834441819; Mon, 15 Mar 2021 11:54:01 -0700 (PDT) X-Received: by 2002:a25:6f41:: with SMTP id k62mr757310ybc.253.1615834441593; Mon, 15 Mar 2021 11:54:01 -0700 (PDT) Path: eternal-september.org!reader02.eternal-september.org!news.uzoreto.com!feeder1.cambriumusenet.nl!feed.tweak.nl!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 15 Mar 2021 11:54:01 -0700 (PDT) In-Reply-To: Injection-Info: google-groups.googlegroups.com; posting-host=80.229.20.55; posting-account=WsVe0AoAAABheGmBjlLgPWhgIw6kxcL6 NNTP-Posting-Host: 80.229.20.55 References: <38356aa9-b8b0-4e0b-a490-99e7b239d0b1n@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Ada and "early return" - opinion/practice question From: John McCabe Injection-Date: Mon, 15 Mar 2021 18:54:01 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:61535 List-Id: On Monday, 15 March 2021 at 18:37:04 UTC, Jeffrey R. Carter wrote: > On 3/15/21 5:46 PM, John McCabe wrote: > > I hope this isn't a FAQ (it's hard to find relevant articles) but can someone guide me on the 'normal' treatment in Ada style of what appears to be referred to (by C/C++ programmers) as early-return. > > > > For example, you have a C++ function (pseudo code sort of thing): <..snip..> > Other than the use of exceptions rather than a return code, this is a standard > idiom in Ada. It's much easier to read and understand than the Pascal approach, > just as a "loop and a a half" is much clearer with an exit than the Pascal approach. Thanks Jeff. > I seem to recall Robert Dewar arguing for this style on here many years ago. >From what I remember of Robert (RIP), I suspect he probably argued against it at some point as well, depending on who he was arguing with :-)