Subject: Re: Parentheses and KNF
To: Brian C. Grayson <bgrayson@marvin.ece.utexas.edu>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: current-users
Date: 08/19/1998 17:22:28
On Wed, 19 Aug 1998 19:37:07 -0500 
 "Brian C. Grayson" <bgrayson@marvin.ece.utexas.edu> wrote:

 >   While we're at it, the KNF doc (/usr/share/misc/style) gives
 > the following as an example of an expression that shouldn't have
 > any more parentheses than those strictly needed:
 >         /*
 >          * Unary operators don't require spaces, binary operators do. Don't
 >          * use parenthesis unless they're required for precedence, or the
 >          * statement is really confusing without them.
 >          */
 >         a = b->c[0] + ~d == (e || f) || g && h ? i : j >> 1;
 > 
 >   Can _anyone_ parse that in 5 seconds or less, or should
 > the comment and the example be changed/updated?  :)

I prefer more parenthesis, as long as it's not unreadable due to all
the curved lines.

Jason R. Thorpe                                       thorpej@nas.nasa.gov
NASA Ames Research Center                            Home: +1 408 866 1912
NAS: M/S 258-5                                       Work: +1 650 604 0935
Moffett Field, CA 94035                             Pager: +1 650 940 5942