comp.lang.ada
 help / color / mirror / Atom feed
From: Ted Dennison <dennison@telepath.com>
Subject: Re: return statements in procedures
Date: 2000/06/05
Date: 2000-06-05T00:00:00+00:00	[thread overview]
Message-ID: <8hgd5c$217$1@nnrp1.deja.com> (raw)
In-Reply-To: 393B2054.618F6E80@baesystems.com.au

In article <393B2054.618F6E80@baesystems.com.au>,
  Matthew Daniel <matthew.daniel@baesystems.com.au> 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.




  parent reply	other threads:[~2000-06-05  0:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-06-05  0:00 return statements in procedures Matthew Daniel
2000-06-05  0:00 ` r_c_chapman
2000-06-05  0:00   ` Robert Dewar
2000-06-05  0:00 ` Ted Dennison [this message]
2000-06-05  0:00 ` Marin D. Condic
2000-06-06  0:00   ` Geoff Bull
2000-06-06  0:00     ` Marin D. Condic
2000-06-05  0:00 ` Geoff Bull
2000-06-06  0:00   ` Robert A Duff
2000-06-05  0:00 ` Robert Dewar
replies disabled

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