Subject: Re: Parentheses and KNF
To: Brian C. Grayson <bgrayson@marvin.ece.utexas.edu>
From: None <seebs@plethora.net>
List: current-users
Date: 08/19/1998 21:55:24
In message <19980819193707.A22081@marvin.ece.utexas.edu>, "Brian C. Grayson" wr
ites:
>  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 guess I'd have to sai I think it should be updated.  I do not feel it is
reasonable to expect people to have a better intuitive sense of precedence
than a randomly selected member of the standards committee.

-s