Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!iuvax!cica!tut.cis.ohio-state.edu!att!dptg!ulysses!andante!alice!ark From: ark@alice.UUCP (Andrew Koenig) Newsgroups: comp.lang.c Subject: Re: C style peeve Keywords: return Message-ID: <10592@alice.UUCP> Date: 18 Mar 90 14:10:32 GMT References: <2205@osc.COM> Organization: AT&T Bell Laboratories, Liberty Corner NJ Lines: 28 In article <2205@osc.COM>, jgk@osc.COM (Joe Keane) writes: > 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. For one thing, it would be the only place in the entire language where it would not be legal to wrap a pair of parentheses around an expression without changing its meaning. That is, (x) is a perfectly good expression, so why shouldn't I be able to use it in a return statement, as return (x) ; ?? A historical note: parentheses are required in return statements in PL/I. This is because PL/I keywords are not reserved words, so the parentheses are necessary to resolve the following ambiguity: return (x) = (y); Does this return the Boolean value of the comparison between x and y, or does it set element number x of an array named `return' to y? -- --Andrew Koenig ark@europa.att.com