summaryrefslogtreecommitdiffstats
path: root/doc/coding-style.txt
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2010-08-05 14:04:24 -0500
committerDenis Kenzior <denkenz@gmail.com>2010-08-05 14:04:24 -0500
commit1b4a5c47abded37d49fdb39e24fe9e4917563c51 (patch)
tree48a47d1f40787face5b8405757082aa61849a721 /doc/coding-style.txt
parent8f570a79697901140348ae7021fa318de1f2f3b2 (diff)
downloadofono-1b4a5c47abded37d49fdb39e24fe9e4917563c51.tar.bz2
doc: Update coding-style.txt for enums
Diffstat (limited to 'doc/coding-style.txt')
-rw-r--r--doc/coding-style.txt24
1 files changed, 24 insertions, 0 deletions
diff --git a/doc/coding-style.txt b/doc/coding-style.txt
index 35b9f584..95ed50b3 100644
--- a/doc/coding-style.txt
+++ b/doc/coding-style.txt
@@ -149,6 +149,30 @@ Any time when creating a new header file with non-public API, that header
must not contain include guards.
+M11: Naming of enums
+====================
+
+Enums must have a descriptive name. The enum type should be small caps and
+it should not be typedef-ed. Enum contents should be in CAPITAL letters and
+prefixed by the enum type name.
+
+Example:
+
+enum animal_type {
+ ANIMAL_TYPE_FOUR_LEGS,
+ ANIMAL_TYPE_EIGHT_LEGS,
+ ANIMAL_TYPE_TWO_LEGS,
+};
+
+If the enum contents have values (e.g. from specification) the preferred
+formatting is as follows:
+
+enum animal type {
+ ANIMAL_TYPE_FOUR_LEGS = 4,
+ ANIMAL_TYPE_EIGHT_LEGS = 8,
+ ANIMAL_TYPE_TWO_LEGS = 2,
+};
+
O1: Shorten the name
====================
Better to use abbreviation, rather than full name, to name a variable,