summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@profusion.mobi>2010-12-23 11:02:56 -0200
committerDenis Kenzior <denkenz@gmail.com>2010-12-23 18:36:58 -0600
commit4df428f4702abdc8c826fbb137c7deab00f1b2b0 (patch)
treebc11b2cd2d80ae0bca1904e0b6333573bd4f9cf0
parent66a8002d6ab3d8eebd2208ae39add3d76bdda6a7 (diff)
downloadofono-4df428f4702abdc8c826fbb137c7deab00f1b2b0.tar.bz2
coding-style: mention preferred line wrap
-rw-r--r--doc/coding-style.txt43
1 files changed, 39 insertions, 4 deletions
diff --git a/doc/coding-style.txt b/doc/coding-style.txt
index 9d7131de..c267b6b1 100644
--- a/doc/coding-style.txt
+++ b/doc/coding-style.txt
@@ -75,10 +75,11 @@ Example:
a + b; // correct
-M4: Long condition
-==================
-If your condition in if, while, for statement is too long to fit in one line,
-the new line needs to be indented not aligned with the body.
+M4: Wrap long lines
+===================
+If your condition in if, while, for statement or a function declaration is too
+long to fit in one line, the new line needs to be indented not aligned with the
+body.
Example:
1)
@@ -91,6 +92,40 @@ if (call->status == CALL_STATUS_ACTIVE ||
call->status == CALL_STATUS_HELD) { // correct
ofono_dbus_dict_append();
+3)
+gboolean sim_ust_is_available(unsigned char *service_ust, unsigned char len,
+ num sim_ust_service index) // wrong
+{
+ int a;
+ ...
+}
+
+4)
+gboolean sim_ust_is_available(unsigned char *service_ust, unsigned char len,
+ enum sim_ust_service index) // correct
+{
+ int a;
+ ...
+}
+
+If the line being wrapped is a function call or function declaration, the
+preferred style is to indent at least past the opening parenthesis. Indenting
+further is acceptable as well (as long as you don't hit the 80 character
+limit).
+
+If this is not possible due to hitting the 80 character limit, then indenting
+as far as possible to the right without hitting the limit is preferred.
+
+Example:
+
+1)
+gboolean sim_ust_is_available(unsigned char *service_ust, unsigned char len,
+ enum sim_ust_service index); // worse
+
+2)
+gboolean sim_ust_is_available(unsigned char *service_ust, unsigned char len,
+ enum sim_ust_service index); // better
+
M5: Git commit message 50/72 formatting
=======================================