Subject: Re: -Wno-parenthesis
To: None <firstname.lastname@example.org>
From: Christos Zoulas <email@example.com>
Date: 06/06/1999 21:15:33
In article <199906062022.NAA20406@elbe.ghs.com> firstname.lastname@example.org (Ross Harvey) writes:
>I think we made a mistake in accepting the exact defaults of -Wall.
>I would like to change it in all the kernel Makefile's to:
> -Wall -Wno-parentheses.
>(It can't be changed in some ports and not others for obvious reasons.)
>I know, C has too many operator priority levels, and I know, some of them
>are peculiar, such as + - over << >>. But -Wparentheses is too strict,
>e.g., it complains about not grouping && instructions just because there
>is an ||.
>Really, though, you shouldn't be hacking the kernel if you don't even know
>the C basics. And there is always `man 7 operator', not to mention
>Plus, redundant parens are prohibited in KNF. (Unless `the statement is
>really confusing without them'. Not `confusing', but `really confusing'.)
>I don't think we should change all those years of KNF tradition just because
>the gcc authors use a different coding style.
Ross, here is where I don't agree. When I made the kernel pass -Wall, I found
quite a bunch of those && || combination warnings. Well, guess what: some
of them were not correct! I think that parentheses are good things because
the show the real programmer's intend as opposed to random guesswork.
If you see:
if (e = f(i))
how can you tell if the person just missed the extra equal sign or he meant
to assign to e?
Please leave things as they are. It is not like we are going to have to
change a lot of code if we do, because all of our code has been changed
to appease gcc' parentheses appetite.