diff options
author | Adam Langley <agl@chromium.org> | 2009-10-07 12:28:10 -0700 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2009-10-07 12:28:10 -0700 |
commit | e8982ab2a6cd8ae66d96b5b384febe3e3a6dacc9 (patch) | |
tree | a5503b5cd876f174f849ab430c1215c6497d74ab /CONTRIBUTING | |
parent | 00f945e54efc112e60ed547c9c7796a7657e4117 (diff) |
doc: update code style docs
Diffstat (limited to 'CONTRIBUTING')
-rw-r--r-- | CONTRIBUTING | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/CONTRIBUTING b/CONTRIBUTING index baf6d2590..47f93700d 100644 --- a/CONTRIBUTING +++ b/CONTRIBUTING @@ -17,3 +17,25 @@ with #ifdef MY_DEFINE / #endif in the code. ... } +* Keep a space between the function name and the opening '('. + GOOD: g_strdup (x) + BAD: g_strdup(x) + +* C-style comments, except for FIXMEs. + GOOD: f(x); /* comment */ + BAD: f(x); // comment + + GOOD: // FIXME: juice the gooblygok + BAD: /* FIXME: juice the gooblygok */ + +* Keep assignments in the variable declaration area pretty short. + GOOD: MyObject *object; + BAD: MyObject *object = complex_and_long_init_function(arg1, arg2, arg3); + +* 80-cols is a guideline, don't make the code uncomfortable in order to fit in + less than 80 cols. + +* Constants are CAPS_WITH_UNDERSCORES and use the preprocessor. + GOOD: #define MY_CONSTANT 42 + BAD: static const unsigned myConstant = 42; + |