This is the mail archive of the
mailing list for the GCC project.
Re: RFC: -Wall by default
On 04/12/2012 03:36 PM, Robert Dewar wrote:
> On 4/12/2012 9:30 AM, Andrew Haley wrote:
>>>> I would also suggest that your competent programmer would know what
>>>> they don't know; when reading code they'd look it up, when writing
>>>> code they'd insert parentheses for clarity.
>> Using two different definitions of "competent programmer" without
>> clarification makes me an incompetent writer, I suppose. :-)
> The correct thing to write definitely does NOT depend on the
> competence or otherwise of the writer. If putting in
> parentheses adds to clarity, then everyone should do it
> since you are writing code for other people to read,
> not yourself.
Certainly, everything that adds to clarity (and has no runtime costs!)
is desirable. But adding parentheses may not add to clarity if doing
so also obfuscates the code. There is a cost to the reader due to a
blizzard of syntactically redundant parentheses; if there weren't, we
wouldn't bother with operator precedence.
Ultimately, it's a matter of taste and experience. I'm going to find
it hard to write for people who don't know the relative precedence of
& and | .