[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: Re: KDE/kdepim/kleopatra/commands
From: David Faure <dfaure () kdab ! net>
Date: 2008-02-13 19:27:17
Message-ID: 200802132027.19327.dfaure () kdab ! net
[Download RAW message or body]
On Wednesday 13 February 2008, Marc Mutz wrote:
> On Wednesday 13 February 2008 17:45, David Faure wrote:
> > On Wednesday 13 February 2008, Marc Mutz wrote:
> > > On Wednesday February 13 2008 16:59, Jarosław Staniek wrote:
> > > > Hmm, after this change: if canceled == true, [2] is executed.
> > > > Before the change, [1] was executed.
> > >
> > > Read again :)
> >
> > It's still ambiguous when reading and {} would make it much clearer.
> >
> > "if if else if else" is definitely not clear to the average reader (me
> > included), while explicit "{...}" cannot hurt.
>
> It is, if you see the indention.
Only if the indentation is correct. I have seen often enough code with indentation
mismatching what the code really does, thus confusing everyone (and introducing bugs).
> And the extra parentheses do hurt, if they're
> not needed. C++ has enough visual clutter, let's not make it worse by this
> backwards "always use {}, even if you don't need it, since some stupid
> maintenance programmer might add a new line and change the meaning of the
> program" rule.
I might agree with the case of simple one-line "then" clauses, but I definitely disagree
in the case of a very large block of code under the if (due to a nested if).
Actual bugs are worse than a pair of {}.
--
David Faure, faure@kde.org, dfaure@klaralvdalens-datakonsult.se
KDE/KOffice developer, Qt consultancy projects
Klarälvdalens Datakonsult AB, Platform-independent software solutions
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic