[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    Re: Coding style
From:       Jan Hambrecht <jaham () gmx ! net>
Date:       2008-06-11 7:40:43
Message-ID: 484F817B.5000706 () gmx ! net
[Download RAW message or body]

Girish Ramakrishnan wrote:
> Hi All,
> The mixing of coding styles in the kotext code has been troubling me. So 
> Thomas, David and I had a discussion on the coding style used in koffice 
> code. We agreed that we should follow the Qt/kdelibs coding style 
> (http://techbase.kde.org/Policies/Kdelibs_Coding_Style). We also agreed 
> that any new code (in new or existing files) will be written in the new 
> style.
> 
> Here's the Qt style in a nutshell.
> 
> // indent = 4 spaces
> void foo(int arg1, int arg2)
> {
>      switch (arg1) {
>      case 1: // do something
>      case 2: // do more
>      default:
>          break;
>      }
> 
>      if (arg2 == 42) {
>          bar(arg2, arg1);
>      }
> }
> 
> Opinions/Thoughts?
> 

Me likes the opening curly brace on an extra line. Additionally i tend 
to use some more whitespace at braces. I.e. void foo( int arg1, int arg2 );

<nitpick>
And while at it, i don't see your example to be really consistent in 
itself. E.g. sometimes the opening brace is placed at an extra line, 
sometimes not. And there is a whitespace before the opening brace of the 
"if" statement, but not before the opening brace of the function header.
</nitpick>

Ciao Jan

_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic