summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@colm.net>2017-01-23 14:16:58 +0700
committerAdrian Thurston <thurston@colm.net>2017-01-23 14:38:46 +0700
commit7691468bd810b0647e1ba034ed7a6b6647e31024 (patch)
tree6fc29dadecf6d5345d0df8cf2c969c4d655f2d32 /doc
parent22c98ce0cb3eb2877428706a0480dee8d5cc6f44 (diff)
downloadcolm-7691468bd810b0647e1ba034ed7a6b6647e31024.tar.gz
three items added to the coding conventions
from Peter Reijnders
Diffstat (limited to 'doc')
-rw-r--r--doc/coding-conventions.txt75
1 files changed, 44 insertions, 31 deletions
diff --git a/doc/coding-conventions.txt b/doc/coding-conventions.txt
index d792f3ac..01a9ed05 100644
--- a/doc/coding-conventions.txt
+++ b/doc/coding-conventions.txt
@@ -1,52 +1,65 @@
CODE
====
-1. Use tabs for indentation. It must always be possible to alter tab expansion
- to any number of characters.
+1. Use tabs for indentation. It must always be possible to alter tab expansion
+ to any number of characters.
-2. Spaces may be used for alignment anytime after the first non-whitespace
- character. Please use sparingly. Preferrably only for formatting lists of
- things.
+2. Spaces may be used for alignment anytime after the first non-whitespace
+ character. Please use sparingly. Preferrably only for formatting lists of
+ things.
- int var1 = 5;
- int othervar = 4;
- int x = 8;
+ int var1 = 5;
+ int othervar = 4;
+ int x = 8;
-3. Try not to go over 100 chars wide.
+3. Try not to go over 100 chars wide.
-4. Statatements that span multiple lines should have two indentations on lines
- two and up.
+4. No trailing whitespace.
- some_function( arg1, arg2, arg3,
- <TAB><TAB>arg4, arg5, arg6 );
+5. Statatements that span multiple lines should have two indentations on lines
+ two and up.
-5. Put spaces on the interior of argument lists
+ some_function( arg1, arg2, arg3,
+ <TAB><TAB>arg4, arg5, arg6 );
- some_function( a );
+6. Put spaces on the interior of argument lists
-6. Blocks with one line don't need to be wrapped in {}
+ some_function( a );
- if ( test )
- call_function();
+7. Blocks with one line don't need to be wrapped in {}
-7. Start a new line after every block close.
+ if ( test )
+ call_function();
+
+8. Start a new line after every block close.
- if ( test ) {
- do_something();
- }
- else {
- something_else();
- }
+ if ( test ) {
+ do_something();
+ }
+ else {
+ something_else();
+ }
+
+9. Function blocks start on a new line
+
+ static int foo( int bar )
+ {
+ return bar++;
+ }
+
+10. Comment with C-style comments.
+
+ /* This is the most important call. */
+ the_program();
-8. Comment with C-style comments.
+11. Disable code (temporarily or for illustration purposes) with C++ style
+ comments. For very large blocks use #if 0.
- /* This is the most important call. */
- the_program();
+ // dont_pass_this_function_zero( 0 );
-9. Disable code (temporarily or for illustration purposes) with C++ style
- comments. For very large blocks use #if 0.
+12. Preprocessor directives have the '#' as the first character
- // dont_pass_this_function_zero( 0 );
+ #define foo(bar) bar++;
COMMITS