Parenthesis welcome

Bas Wijnen wijnen at debian.org
Fri Oct 25 10:31:32 EDT 2013


On Wed, Oct 23, 2013 at 06:23:30PM +0200, Hans Bezemer wrote:
> > I've been on a crusade against redundant parentheses for a long time.
> > They often make it hard to read other people's work and obscure the
> > programmer's intentions.
> On the contrary: this kind of "beautification" makes it harder to read a 
> program without a C manual beside you

Knowing the precedence rules wouldn't require a manual if people would
do it right most of the time.  The problem is they don't, so you keep
thinking "wait, was this required or not?  I remember I put parentheses
on it last time, but was that just to be sure or did I really need
them?"

> It also protects you from accidental errors, since it's crystal clear what you 
> mean. Even if the C standard would change, it would not affect my code.

Actually, Werner wrote quite a bit about how the parenthesis can hide
errors (or worse, malicious code).

> It is also a sign that the programmer has no intention to use my ignorance in 
> order to install a backdoor.

So this seems a direct contradiction. ;-)  The code he quoted actually
was an attempt at doing just that, and it only worked because of the
parentheses.

Of course the real problem is that C allows assignments as part of an
expression.

> I have no Facebook account. Consequently, I have no friends and I don't like 
> anything. Deal with it.

Hahaha, good one!

Thanks,
Bas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.en.qi-hardware.com/pipermail/discussion/attachments/20131025/39c96738/attachment.pgp>


More information about the discussion mailing list


interactive