From kde-commits Wed Feb 13 19:27:17 2008 From: David Faure Date: Wed, 13 Feb 2008 19:27:17 +0000 To: kde-commits Subject: Re: KDE/kdepim/kleopatra/commands Message-Id: <200802132027.19327.dfaure () kdab ! net> X-MARC-Message: https://marc.info/?l=kde-commits&m=120293089306335 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