Subject: Re: KNF and braces (was: Re: EGCS 1.1 UPDATE rev. 4)
To: Chris G. Demetriou <cgd@netbsd.org>
From: Todd Vierling <tv@pobox.com>
List: current-users
Date: 08/18/1998 14:35:31
On 18 Aug 1998, Chris G. Demetriou wrote:

: > - egcs issues warnings about "ambiguous braces" that is supposedly against
: >   KNF (I haven't checked thoroughly).  Use "CFLAGS+=-Wno-parentheses" in
: >   /etc/mk.conf to override this behavior.  This may be removed from the
: >   set of warnings issued by "-Wall".

: "No braces are used for control statements with zero or only a single
: statement."

:         for (;;)
:                 stmt;

What egcs "warns" about (or, rather "suggests" in the form of a warning - it
even starts wit the word "suggest") is something like:

if (condition1)
	if (condition2)
		stmt1;
	else
		stmt2;

where the hanging "else", while definitely tied to the innermost `if' by C
parsing convention, is what egcs is warning about.  To avoid the warning,
you need to brace the entire outer "if".

-- 
-- Todd Vierling (Personal tv@pobox.com; Bus. todd_vierling@xn.xerox.com)