Path: utzoo!utgpu!water!watmath!clyde!att!ihnp4!ihlpf!nevin1 From: nevin1@ihlpf.ATT.COM (00704a-Liber) Newsgroups: comp.lang.c Subject: Re: Unnecessary parenthesis Message-ID: <5253@ihlpf.ATT.COM> Date: 8 Jul 88 23:02:40 GMT References: <326@marob.MASA.COM> <2550075@hpisod2.HP.COM> Reply-To: nevin1@ihlpf.UUCP (00704a-Liber,N.J.) Organization: AT&T Bell Laboratories - Naperville, Illinois Lines: 39 In article <2550075@hpisod2.HP.COM> decot@hpisod2.HP.COM (Dave Decot) writes: |> 3) The programmer has gotten used to putting parentheses around just about |> everything. |That may be true in your case, but it's a bug in the language design. If it is truly a bug, how would you propose fixing it? |Parentheses are overloaded for all of the following distinct purposes: | function calls | if, while, and do-while statements | casts | type construction (used both to indicate functions and for grouping) | function declarations | evaluation order grouping Since 'return' can return an expression, parentheses are always allowed (but never required). Does it really matter whether they are there or not? Is it really any harder to understand a program that has them vs. one that does not? |I see no reason to add further confusion by making flow control look like |a function call. I use "return e;" because it's less cluttered and more |distinct. For the case of a constant or a single variable, I do too. But on those few occasions that I have to return an expression (instead of using a tmp variable and returning that), I sometimes put parentheses around the expression. If it makes it easier to read, then put them in. Otherwise, (as long as it doesn't make it harder to read), it really shouldn't matter. -- _ __ NEVIN J. LIBER ..!ihnp4!ihlpf!nevin1 (312) 510-6194 ' ) ) You are in a maze of little twisty / / _ , __o ____ email paths, all different. / (_