Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site busch.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxn!ihnp4!mgnetp!we53!busch!dcm From: dcm@busch.UUCP (Craig Miller) Newsgroups: net.lang.c Subject: Re: "break" statements Message-ID: <515@busch.UUCP> Date: Fri, 1-Nov-85 08:06:49 EST Article-I.D.: busch.515 Posted: Fri Nov 1 08:06:49 1985 Date-Received: Sun, 3-Nov-85 04:58:34 EST References: <678@ucsfcgl.UUCP> <2600026@ccvaxa> Reply-To: dcm@busch.UUCP (Craig Miller) Organization: Anheuser-Busch Companies - St. Louis Missouri Lines: 41 Keywords: multiple returns In article <2600026@ccvaxa> preece@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.