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.3 required=5.0 tests=BAYES_00,INVALID_MSGID, MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,9e90e30a519a635b X-Google-Attributes: gid103376,public From: Ted Dennison Subject: Re: return statements in procedures Date: 2000/06/05 Message-ID: <8hgd5c$217$1@nnrp1.deja.com>#1/1 X-Deja-AN: 631280734 References: <393B2054.618F6E80@baesystems.com.au> X-Http-Proxy: 1.0 x61.deja.com:80 (Squid/1.1.22) for client 204.48.27.130 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Mon Jun 05 14:23:58 2000 GMT X-MyDeja-Info: XMYDJUIDtedennison Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.7 [en] (WinNT; I) Date: 2000-06-05T00:00:00+00:00 List-Id: In article <393B2054.618F6E80@baesystems.com.au>, Matthew Daniel wrote: > we are having a "discussion" at work at the moment about return > statements in procedures. > > There is one who believes it is acceptable for certain circumstances > and the rest of us do not believe it should occur. Personally, I have no compunction about doing that where I believe it would make the code simpler and easier to understand. Sorting and searching are the most common examples. Answer me this: If lack of a "return" causes developers to have to add extra flags and convoluted (and CPU-consuming) control logic, what exactly have you gained for this trade-off? I once worked on a DoD INFOSEC job where we had a requirement for no more than one exit path out of any subroutine. My cubemate was shocked when he saw that I put a "return" in a procedure, but the "return" was the only logical (non-exceptional) path out of the procedure, so it was perfectly kosher with our customer. :-) Note that if you *do* restrict that keyword, you should also consider forbiding exceptions in procedures. They allow roughly the same thing, and some developers (particularly your "one") are bound to use them to get around that annoying restriction. -- T.E.D. http://www.telepath.com/~dennison/Ted/TED.html Sent via Deja.com http://www.deja.com/ Before you buy.