Consensus on the kdelibs coding style

Alexander Neundorf neundorf at kde.org
Sat Jul 5 22:22:43 BST 2008


On Saturday 05 July 2008, Roland Harnau wrote:
> 2008/7/5, Lubos Lunak <l.lunak at suse.cz>:
> > On Saturday 05 of July 2008, Thiago Macieira wrote:
> >> A distant second is the placement of the braces. Your style is closer to
> >> my own preferred style, actually, but I'd still advocate for matching
> >> Qt's simply because of pragmatism.
> >
> >  Which pragmatism? A small number of people working on Qt and KDE at the
> > same  time, or some other codebase which uses it? According to my search
> > on kdecore and kdeui there is a slight preference for trailing { (i.e.
> > Qt), but it's not  vast majority and I think that strictly technically
> > speaking aligned {} are better for readability (e.g. in the switch/case
> > unindented case, a trailing { seems quite hard to see).
>
> I don't see how it is possible to speak about readability  "strictly
> technically", at least not without a scientific definition of the term in
> one hand and a bunch of empirical studies proving your point in the other.
> I generally prefer trailing braces, but  I can live with the current style 
> (trailing braces only for control statements). What I don't like  are
> braces for a single-line body of  a conditional statement 

They help avoiding stupid mistakes when copying/deleting/modifying code, some 
might also say it looks nicer.
While in the beginning it feels strange, you can get used to it and then you 
don't want to miss it anymore.

Alex




More information about the kde-core-devel mailing list