Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!panda!talcott!harvard!seismo!brl-tgr!tgr!cottrell@nbs-vms.ARPA From: cottrell@nbs-vms.ARPA Newsgroups: net.lang.c Subject: return exp Message-ID: <8627@brl-tgr.ARPA> Date: Mon, 25-Feb-85 15:57:19 EST Article-I.D.: brl-tgr.8627 Posted: Mon Feb 25 15:57:19 1985 Date-Received: Wed, 27-Feb-85 21:15:39 EST Sender: news@brl-tgr.ARPA Lines: 38 /* Kevin Szabo responds... > In article <8048@brl-tgr.ARPA> cottrell@nbs-vms.ARPA writes: > > if (exp) if (exp) { > > return exp; exp; > > return; > > } > > > >The example on the left avoids the braces while semi-documenting > >the fact that. I know, you are shocked! I'm just a bad guy. > > Sir, you are a sinner. I hope I never have to look at your code. ( 1/2 :-) ) > The code on the left tells me that you are trying to pass back > a value to the calling routine, and I would be confused as to why > the calling routine chose to ignore it. If you insert a comment > to document the fact you are doing something odd, why not just do > it right the first time and avoid the comment? Of course you may > not put in any comments, but I amazed that you can figure out what > your code does three months after you wrote it. > > You really should be coding in B, or assembler. > "I stab at you from hell's heart" -- The Wrath of Khan Okay, I guess this is my convention. I am NOT returning a value; when I DO return a value, I do return(exp), with parens. One thing I didn't say is that I #define VOID int to flag the misuse (This was before my compiler supported void). What I'm really against is the idea that I can say `if (exp) exp, exp;', but not `if (exp) exp, return;'. Since return is a `statement' I have to do `if (exp) {exp; return;}'. This is stupid. In fact, the `one statement' philosophy is stupid. An explicit `endif' ala cpp would be nicer, and else's would always match the right if. One must know the rules before breaking them. I do. Actually, my code is quite readable. Wanna try? jim */