Consensus on the kdelibs coding style

Cristian Tibirna tibirna at kde.org
Mon Jul 7 16:19:26 BST 2008


On Saturday, 5 July 2008, Lubos Lunak wrote:
> On Saturday 05 of July 2008, Thiago Macieira wrote:
> > Lubos Lunak wrote:
> > >which defines even completely useless things like
> > >requiring {}'s around a single-line if() body statement (where's the
> > > point in that?), I'd prefer something simple.
> >
> > Just for information, that requirement is not in the Qt style. That's
> > actually one of modifications that was added to the KDE Libs style on top
> > of the Qt style. If you look at Qt code, you'll see that is not used.
>
>  I wonder how it got there then, especially when the proponents seemed
> quite strict on "no modifications".

It was there since very early in KDE life. And from 15 years of student 
support work, I can see the usefulness:

Code like

if (condition)
   original_procedure_line;

Becomes very easily, in hands of novices, something like:

if (condition)
   new_fake_block_procedure_line_that_would_have_required_brackets;
   original_procedure_line;

with subtle but possibly very ugly effects.

(... and people are bikeshedding on Python indenting...)


Mandatory ubiquitous use of  '{' and '}' guards efficiently annul the 
probability of such errors.

That being said, in the later years, having lost patience with unwaranted 
illiteracy, I learned to like the non-bracket one-liners, along with learning 
to automatically reindent (in some competent editor) any file that I didn't 
produce or that got touched by strangers since my last visit.

Now, I don't intend to participate in this debate (I'm an uofficial member 
of "minimal law better law" party). But I just wanted to answer the 
rethorical question (and gloat over my detailed -- and perhaps majorly 
deluded -- memories of the KDE history)

Thanks.

-- 
Cristian Tibirna
KDE developer .. tibirna at kde.org .. http://www.kde.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080707/98241f4d/attachment.sig>


More information about the kde-core-devel mailing list