"break" statements

Craig Miller dcm at busch.UUCP
Fri Nov 1 23:06:49 AEST 1985


In article <2600026 at ccvaxa> preece at ccvaxa.UUCP writes:
>
>Do you also object (it's EXACTLY the same argument) to having more
>than one "return" statement in a function definition?
>
>-- 
>scott preece
>gould/csd - urbana
>ihnp4!uiucdcs!ccvaxa!preece

(yet another of my pet peeves...)

I object.  I find a function that has lots of returns harder than hell
to read.  How can you call a function with 10 returns top down?  Come on.
There are a *few* exceptions when multiple returns makes a function more
readable.  If a function of mine looks more readable with multiple returns,
I start looking for the problem within that function.  Usually I tried to
have the function do too much, and breaking the function into smaller, more
concise functions fixes the problem.

Btw, the same goes for programs with multiple exits (*especially* those
that exit from within a function other than main.  yuck).  Almost all of
my programs have one return statement in main.  (my personal preference
is return, but an exit doesn't bother me when called in main...)

Whatever happened to top-down programming, anyway?  Some people think
that just because they program in C makes them structured programmers.
Wrong.  It still takes some effort.

Maybe there ought to be a mailing list or a new group just on programming
style?  (and not necessarily just in C - a lot of style things don't depend
on the language)

		Craig
-- 
	Craig Miller
	{*}!ihnp4!we53!busch!dcm
	The Anheuser-Busch Companies; St. Louis, Mo.

- Since I'm a consultant here and not an Anheuser-Busch employee, my
  views (or lack of) are strictly my own.



More information about the Comp.lang.c mailing list