[Development] kdelibs coding style

André Pönitz andre.poenitz at mathematik.tu-chemnitz.de
Mon Apr 29 23:30:59 CEST 2013


On Mon, Apr 29, 2013 at 10:37:10PM +0200, Giuseppe D'Angelo wrote:
> On 29 April 2013 21:20, Thiago Macieira <thiago at kde.org> wrote:
> > On segunda-feira, 29 de abril de 2013 18.52.16, Giuseppe D'Angelo wrote:
> >> On 29 April 2013 18:43, Thiago Macieira <thiago at kde.org> wrote:
> >> > With that in mind, I would suggest we change *both* coding styles to
> >> > optionally permit the braces, and strongly suggest it for more-complex
> >> > conditionals.
> >>
> >> In Qt the braces are already mandatory if the condition spans over
> >> more than one line (which is typical for complex conditions, as other
> >> rules demand for lines to be properly wrapped). Are you suggesting to
> >> loosen this?
> >
> > No, I am suggesting adding that rule, because I didn't know it was there (it
> > wasn't there when I last looked at the document, in my early days in
> > Trolltech).
> 
> It's there [1]
> > * Exception 1: Use braces also if the parent statement covers several lines / wraps:
> 
> and
> > Keep lines shorter than 100 characters; wrap if necessary
> 
> [1] http://qt-project.org/wiki/Qt_Coding_Style
> 
> I also support the idea of avoiding to remove braces if the body
> collapses to one statement only.

The rules are ok as they are (pretty much as _any_ set of consistently
applied and not-completely-weird rules). Opening them up only leads to
more review bikeshedding.

It's not that people actively change coding style in old Qt code, and
there's always the "don't stick to the rules if it makes you look bad"
excuse.

I personally would be happy enough if at least new code pretended to
roughly stick to the existing rules, before inventing new ones...

Andre'



More information about the Development mailing list