Consensus on the kdelibs coding style

Fela Winkelmolen fela.kde at gmail.com
Sun Jul 6 05:56:41 BST 2008


What about the following policy:

1. Use 4 spaces, no tabs. (or maybe just "no tabs")

2. Be consistent. 

3. When editing existing code conform to the surrounding coding style.

4. If you don't mind what coding style to use we suggest the Qt style[1], but 
else any style already used inside KDE is fine (i.e. don't use GNU styles or 
similar), as long as it's consistent. The policy of subprojects may vary.


Maybe 4. could be elaborated a bit further, for example saying: 
Either use trailing opening braces or opening braces in the next line, 
indented to the same level as the control statement. Everything should be 
indented except optionally label like constructs (public:, private:, case 
x:, ...).

[1] Why the Qt style? Why not? I chose it because it's what is currently 
suggested on techbase, else we could make a pool to chose the suggested 
style. Also Qt/K&R style seem to be the only style used that has somewhat 
been formalized, all other styles could be described as personal style of 
person X.




More information about the kde-core-devel mailing list