Skip site navigation (1)Skip section navigation (2)
Date:      	Wed, 20 Jan 1999 17:52:52 +0100
From:      "Jeroen C. van Gelderen" <gelderen@mediaport.org>
To:        "Robert Nordier" <rnordier@nordier.com>, "Peter Wemm" <peter@netplex.com.au>
Cc:        <fenner@parc.xerox.com>, <bde@zeta.org.au>, <cvs-committers@FreeBSD.ORG>
Subject:   Re: -Werror
Message-ID:  <031a01be4495$52293240$0d79eb0a@deskfix.local>

next in thread | raw e-mail | index | archive | help
From: Robert Nordier <rnordier@nordier.com>
>For example, compiled with -Wall, the code fragment
>
>    if (x = y)
>     x = z + 1 & 7;
>
>causes two warnings
>
>    suggest parentheses around assignment used as truth value
>    suggest parentheses around + or - in operand of &
>
>but rewriting to eliminate the errors would violate a style(9)
>guideline (unnecessary parentheses).

Maybe you should consider updating style(9). A lot of companies would
consider parentheses in the last line absolutely neccessary. Chances are
that requiring parentheses in the first line will catch a few errors.
Chances that extra parentheses in the first line will *cause* errors are
quite small. Especially when you rewrite the line like:
 if( (x = y) != 0 )
which *IMHO* is the only correct way.


>There's an awful lot of BSD
>code like this, that could cause huge {Net,Open}BSD diffs if
>rewritten.

Hmm, but I thought the other BSD(s?) used -Werror? That would reverse your
argument ;)


>So (to give just one example) if -Werror if used, -Wall becomes
>problematic.  And so -Werror may result in useful warnings getting
>turned off rather than on.

Fix style(9) and that problem goes away.

A non-committer's view...,
Jeroen
--
Jeroen C. van Gelderen -- gelderen@mediaport.org -- 0x46D8D3C8 -- &[8-D}~<=


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?031a01be4495$52293240$0d79eb0a>