From 7906eea45cdfbe54be96d6bc99906e492d14f284 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 1 Apr 2011 17:51:01 +0200 Subject: Update coding style --- doc/reference/xml/coding-standards.xml | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/doc/reference/xml/coding-standards.xml b/doc/reference/xml/coding-standards.xml index e3d549f4..242719de 100644 --- a/doc/reference/xml/coding-standards.xml +++ b/doc/reference/xml/coding-standards.xml @@ -39,7 +39,22 @@ Whenever you edit a source file, don't forget to update the copyright dates at t Indentation is done with tabs and alignment is done with spaces. This way, the code looks -neat whatever width you configure your editor to display tabs as. +neat whatever width you configure your editor to display tabs as. This means, +for example: + + + +struct something +{ + int thing; /* <--- spaces used to align comments */ + int thing_with_longer_name; /* <--- spaces used to align comments */ +} + +void somefunction(int something) +{ + /* <--- Tab character used at the start of this line */ +} + However, code must be strictly wrapped at 80 columns, or @@ -47,6 +62,23 @@ what would be 80 columns if the tabs were displayed as 8 spaces. If you think you need more width, you're at too many levels of indentation and need to break things down a bit. + +When performing a two or three dimensional iteration, for example over image +coordinates or Miller indices, it is acceptable to indent as follows: + + + +for ( h=-10; h<+10; h++ ) { +for ( k=-10; k<+10; k++ ) { +for ( l=-10; l<+10; l++ ) { + + /* Do stuff */ + +} +} +} + + -- cgit v1.2.3