[ovs-dev] [PATCH v2] datapath-windows: update CodingStyle guideline for variable names

Nithin Raju nithin at vmware.com
Tue Sep 9 16:02:36 UTC 2014


During a review, it seemed that some of the conventions were not clear.
Fixing them in this patch.

Signed-off-by: Nithin Raju <nithin at vmware.com>
Reported-by: Samuel Ghinet <sghinet at cloudbasesolutions.com>
---
 datapath-windows/CodingStyle |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/datapath-windows/CodingStyle b/datapath-windows/CodingStyle
index 006adfd..3550cdb 100644
--- a/datapath-windows/CodingStyle
+++ b/datapath-windows/CodingStyle
@@ -40,8 +40,14 @@ guidelines:
 
   Use lower case to begin the name of a variable.
 
+  Do not use '_' to begin the name of the variable. '_' is to be used to begin
+  the parameters of a pre-processor macro.
+
   Use upper case to begin the name of a function, enum, file name etc.
 
+  Static functions whose scope is limited to the file they are defined in can
+  be prefixed with '_'. This is not mandatory though.
+
   For types, use all upper case for all letters with words separated by '_'. If
   camel casing is preferred, use  upper case for the first letter.
 
@@ -72,6 +78,13 @@ OvsDetectTunnelRxPkt(POVS_FORWARDING_CONTEXT ovsFwdCtx,
     return FALSE;
 }
 
+  For declaring variables of pointer type, use of the pointer data type
+prefixed with 'P' is preferred over using '*'. This is not mandatory though,
+and is only prescribed since it is a common practice in Windows.
+
+  Example, #1 is preferred over #2 though #2 is also equally correct:
+  1. PNET_BUFFER_LIST curNbl;
+  2. NET_BUFFER_LIST *curNbl;
 
 COMMENTS
 
-- 
1.7.4.1




More information about the dev mailing list