Subject: misc/6714: KNF clarification
To: None <gnats-bugs@gnats.netbsd.org>
From: None <bgrayson@ece.utexas.edu>
List: netbsd-bugs
Date: 01/02/1999 02:17:33
>Number:         6714
>Category:       misc
>Synopsis:       KNF clarification
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    misc-bug-people (Misc Bug People)
>State:          open
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jan  2 00:20:01 1999
>Last-Modified:
>Originator:     Brian Grayson
>Organization:
	Parallel and Distributed Systems
	Electrical and Computer Engineering
	The University of Texas at Austin
>Release:        Dec 31 1998
>Environment:

>Description:
	As discussed in August (I've been very remiss in send-pr'ing),
	the section about when to use parentheses is absurd.
	The improved parenthesizing was provided by John F.
	Woods, with a further suggestion by Ted Lemon.
>How-To-Repeat:
>Fix:
--- /usr/src/share/misc/style.dist	Sat Jan  2 02:08:30 1999
+++ /usr/src/share/misc/style	Sat Jan  2 02:11:51 1999
@@ -188,9 +188,10 @@
 	/*
 	 * 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.
+	 * statement is really confusing without them, like:
+	 * a = b->c[0] + ~d == (e || f) || g && h ? i : j >> 1;
 	 */
-	a = b->c[0] + ~d == (e || f) || g && h ? i : j >> 1;
+	a = ((b->c[0] + ~d == (e || f)) || (g && h)) ? i : (j >> 1);
 	k = !(l & FLAGS);
 
 	/*
>Audit-Trail:
>Unformatted: