Xref: utzoo alt.peeves:1467 comp.lang.c:27003 Path: utzoo!attcan!uunet!mailrus!cs.utexas.edu!usc!elroy.jpl.nasa.gov!decwrl!ucbvax!ucsfcgl!cca.ucsf.edu!hoptoad!asylum!osc!jgk From: jgk@osc.COM (Joe Keane) Newsgroups: alt.peeves,comp.lang.c Subject: C style peeve Summary: Return is not a function. Keywords: return Message-ID: <2205@osc.COM> Date: 17 Mar 90 02:14:03 GMT Reply-To: jgk@osc.COM (Joe Keane) Followup-To: alt.peeves Organization: Object Sciences Corp., Menlo Park, CA Lines: 24 Here's my biggest C style peeve. For some reason, many C programmers insist on always putting parentheses around return values, even when they're not necessary, which happens to be always. God knows why, but they write `return(2+2);' instead of the obvious and K&R-approved style `return 2+2;'. It's a shame the compiler lets them get away with it, and i think the extra parentheses should be strictly illegal. Unfortunately, for some reason the ANSI committee didn't like this suggestion. Apparently it would break existing code, you know the same code that assumes you can determine whether your program is demand-pages by examining the contents of word 0. So why do people do this? I guess they think return is a function, although you never know what's inside some people's heads. I think they don't understand what a control structure is, and what the parentheses in if, while, and switch statements are for. I wonder how many times they write `break();' or `goto(label);' and scratch their heads trying to figure out what's wrong with the compiler. I know there are a lot of people that do this, so i'm probably putting my life in jeopardy by making this post. I'm sure some of you will be insulted by my criticism of your coding style, and will get all defensive. I've heard all the defenses, like ``it makes it clearer'' (yeah right!), so don't bother posting yours. Just think about it. Thanks. Oh yeah, the second paragraph is completely false.