Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!elroy.jpl.nasa.gov!ames!amdahl!rtech!mikes@rtech.UUCP From: mikes@rtech.UUCP (Mike Schilling) Newsgroups: comp.lang.c Subject: Re: if (e1) return e2; [else] s1; Message-ID: <5099@rtech.rtech.com> Date: 25 Mar 90 20:59:18 GMT References: <10624@alice.UUCP> Sender: news@rtech.rtech.com Lines: 26 From article <10624@alice.UUCP>, by ark@alice.UUCP (Andrew Koenig): > Some people take the view that except at the end of a function, > `return' is just a funny way of spelling `goto.' A shop of horrors I once worked in used the following coding standard, thinking it was good style: 1. Only one return statement per function. 2. No goto's, even for error handling. 3. Tabs are eight spaces wide, as ASCII intended. The result, of course, was that any function which did input argument checking began its useful life indented at least 32 spaces, and ended: } } } } return(error_status); } I've always thought that leaving the main processing code once it's clear that special error processing is needed makes code both easier to read and more maintainable. ---------------------------------------------------------------------------- mikes@rtech.com = Mike Schilling, Ingres Corporation, Alameda, CA Just machines that make big decisions, Programmed by fellows with compassion and vision. -- Donald Fagen, "IGY"