summaryrefslogtreecommitdiff
path: root/content/xdocs/CppStyleGuide.html
blob: 92f21cd50382e7ad72da9d464696646866d87957 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<html>
    <head>
        <title>Apache Qpid : CppStyleGuide</title>
	    <link rel="stylesheet" href="styles/site.css" type="text/css" />
        <META http-equiv="Content-Type" content="text/html; charset=UTF-8">	    
    </head>

    <body>
	    <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
		    <tr>
			    <td valign="top" class="pagebody">
				    <div class="pageheader">
					    <span class="pagetitle">
                            Apache Qpid : CppStyleGuide
                                                    </span>
				    </div>
				    <div class="pagesubheading">
					    This page last changed on Apr 24, 2007 by <font color="#0050B2">aconway</font>.
				    </div>

				    <h1><a name="CppStyleGuide-QpidCstyleguide"></a>Qpid C++ style guide</h1>

<p>Qpid C++ follows this guide: <a href="http://geosoft.no/development/cppstyle.html" title="Visit page outside Confluence">http://geosoft.no/development/cppstyle.html</a></p>

<p>With the following amendments:</p>

<ul>
	<li>Rule 34: Qpid source files have .h and .cpp extensions.</li>
	<li>Rule 71: Qpid uses 4 space indent, not 2. <b>No tabs</b>.</li>
	<li>Rule 75, 81: Qpid allows (but does not require) else/catch to be on same line as preceeding }</li>
	<li>Rule 11: Qpid does <em>not</em> add an underscore to member variable names.</li>
</ul>


<p>And the following additional rules:</p>

<ul>
	<li>Rule q1: Unlike other blocks, the contents of namespace blocks are <em>not</em> indented to prevent excessive line splitting, and multiple namespaces may be opened or closed on a single line. For example:
<div class="code"><div class="codeContent">
<pre class="code-java">namespace qpid { namespace common {

class SomeClass {
  void foo();
};

}} <span class="code-comment">// namespace qpid::common</span></pre>
</div></div></li>
</ul>




<h2><a name="CppStyleGuide-Debateandchanges"></a>Debate and changes</h2>

<p>The discussion on qpid-dev did raise debate about some points of the style guide. The exceptions and new rules above reflect:</p>
<ul>
	<li>Points that were agreed on the list.</li>
	<li>De-facto style of the codebase as it stands today.</li>
</ul>


<p>Anyone who feels strongly about further modifications to the style guide should:</p>
<ol>
	<li>Raise the issue on qpid-dev.</li>
	<li>Get consensus among the active qpid C++ developers for the change.</li>
	<li>Reformat the entire qpid codebase to conform to the change.</li>
</ol>


<p>If you are not willing to do step 3 then don't bother raising the issue.</p>


				    
                    			    </td>
		    </tr>
	    </table>
	    <table border="0" cellpadding="0" cellspacing="0" width="100%">
			<tr>
				<td height="12" background="border/border_bottom.gif"><img src="border/spacer.gif" width="1" height="1" border="0"/></td>
			</tr>
		    <tr>
			    <td align="center"><font color="grey">Document generated by Confluence on Apr 22, 2008 02:47</font></td>
		    </tr>
	    </table>
    </body>
</html>