Document the current state of naming in ui/qt. Say it's OK to use C++
authorgerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 3 Sep 2013 18:50:17 +0000 (18:50 +0000)
committergerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 3 Sep 2013 18:50:17 +0000 (18:50 +0000)
comments in C++ code.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@51739 f5534014-38df-0310-8fa8-9805f1628bb7

doc/README.developer
doc/README.qt

index 0581df56be1088784f5fd9b4e257981229f576cd..4c5a85307ca848554249a1bcb44e9123b03d6079 100644 (file)
@@ -72,10 +72,11 @@ different compilers; here are some rules for writing code that will work
 on multiple platforms.
 
 Don't use C++-style comments (comments beginning with "//" and running
-to the end of the line); Wireshark's dissectors are written in C, and
-thus run through C rather than C++ compilers, and not all C compilers
-support C++-style comments (GCC does, but IBM's C compiler for AIX, for
-example, doesn't do so by default).
+to the end of the line) in C code. Wireshark's dissectors are written in
+C, and thus run through C rather than C++ compilers, and not all C
+compilers support C++-style comments (GCC does, but IBM's C compiler for
+AIX, for example, doesn't do so by default). C++-style comments can be
+used in C++ code, of course.
 
 In general, don't use C99 features since some C compilers used to compile
 Wireshark don't support C99 (E.G. Microsoft C).
index 7b9130503d15112e2e0182a11b31c5121a763b86..fd3490159f6e2d1f9fc36d42208eda538f2a2a03 100644 (file)
@@ -149,7 +149,25 @@ DO NOT simply port things over. Every feature, window, and element should be
 re-thought. For example, should the user have to navigate two dialogs to get
 HTTP request statistics?
 
-2.1 Changes
+2.1 Coding guidelines
+
+2.1.1 Name conventions
+
+Most of the code in the ui/qt directory uses three APIs: Qt (which uses
+InterCapConvention), GLib (which uses underscore_convention), and the Wireshark
+API (which also uses underscore_convention). As a general rule Wireshark's Qt
+code uses InterCapConvention for class names and methods and
+underscore_convention for variables, with a trailing underscore for member
+variables.
+
+2.1.2 Mixing C and C++
+
+Sometimes we have to call C++ functions from one of Wireshark's C callbacks and
+pass C++ objects to or from C. The C++ FAQ describes how to do this safely:
+
+http://www.parashift.com/c++-faq/mixing-c-and-cpp.html
+
+2.2 Changes
 
 - The display filter entry has been significantly reworked.