<div><b><span class="Apple-style-span" style="font-weight: normal; ">I&#39;ve updated the text based on the discussion from yesterday with added verbage in <span class="Apple-style-span" style="background-color: rgb(102, 255, 153);">green</span> (I didn&#39;t try to show removed text unless the whole recommendation was removed.)</span></b></div>
<div><br></div><div>As a side note, before being put in the style guide several of these items would be fleshed out slightly with good/bad examples.</div><div><br></div><div><span class="Apple-style-span" style="font-size: large;">New version</span></div>
<div><span class="Apple-style-span" style="font-size: large;"><br></span></div><div><div class="gmail_quote"><b><div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><span style="font-weight:normal"><b>Comments</b></span></blockquote>
</div>

</b><div>
<div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><span class="Apple-style-span" style="background-color: rgb(102, 255, 153);">Usually,</span> comments should look like sentences by beginning with a capital and ending with a period (punctation). <span class="Apple-style-span" style="background-color: rgb(102, 255, 153);">One exception may be end of line comments like this &quot;</span><span class="Apple-style-span" style="font-size: 13px; border-collapse: collapse; "><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="background-color: rgb(102, 255, 153);">if (x == y) // false for NaN</span></font></span><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><span class="Apple-style-span" style="background-color: rgb(102, 255, 153);">&quot;.</span></span><div>
There should be a <i>single</i> space after punctation and before the next sentence.</div><div><br></div><div>There should only be a single space before end of line comments. <span class="Apple-style-span" style="background-color: rgb(102, 255, 153);">An exception is if one is lining up several end of line comments.</span></div>
<div><br></div><div>Use FIXME: to denote items that need to be addressed in the future.</div><div><br></div><div><b><span class="Apple-style-span" style="background-color: rgb(102, 255, 153);">Copyright formatting</span></b></div>
</blockquote><span class="Apple-style-span" style="background-color: rgb(102, 255, 153);"></span><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><span class="Apple-style-span" style="background-color: rgb(102, 255, 153);"></span></span></div>

<div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><span class="Apple-style-span" style="background-color: rgb(102, 255, 153);">If you modify over 10 lines of code in a file, please add your copyright line in the file.</span><div>
<span class="Apple-style-span" style="background-color: rgb(255, 255, 102);"><br></span></div><div><span class="Apple-style-span" style="background-color: rgb(102, 255, 153);">Ideally, the line would the follow these rules pattern for uniformit</span><span class="Apple-style-span" style="background-color: rgb(102, 255, 153);">y.</span></div>
<div>In copyright entries, don&#39;t use ranges for years.</div><div>Use capital (C) for the copyright and no comma after the last year.</div><div><span class="Apple-style-span" style="background-color: rgb(102, 255, 153);">Each line should have its own &quot;Copyright (C)&quot; before it.</span></div>
<div><br></div><div>Example of two well formed copyright lines: </div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="font-family: arial; "><div><font face="&#39;courier new&#39;, monospace"> * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="font-family: arial; "><div><font face="&#39;courier new&#39;, monospace"> * Copyright (C) 2009 Somebody &lt;email&gt;</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><br></font></div></span></font></div></span></font></div><div><b>Function parameters</b></div><div>
Don&#39;t put in parameter names <span class="Apple-style-span" style="background-color: rgb(102, 255, 153);">in function declarations </span>if they don&#39;t add information.  A good rule of thumb is if the parameter type name contains the parameter name (with<span class="Apple-style-span" style="background-color: rgb(102, 255, 153);">out</span> trailing numbers or pluralization), then the parameter name isn&#39;t needed.  Usually, there should be a parameter name for bools, strings, and numerical types.</div>
<div><br></div><div>Use enums instead of bools for parameters<span class="Apple-style-span" style="background-color: rgb(102, 255, 153);"> if the value&#39;s meaning will be ambiguous at the calling site.</span></div><div>
<span class="Apple-style-span" style="background-color: rgb(102, 255, 153);"><br></span></div><div><span class="Apple-style-span" style="background-color: rgb(102, 255, 153);">Good:</span></div><div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">
<span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><span class="Apple-style-span" style="background-color: rgb(102, 255, 153);">doSomething(myData, m_memberBool1, 0, m_memberBool2, localBool);</span></span><div>
<font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><span class="Apple-style-span" style="background-color: rgb(102, 255, 153);">setFlag(true);</span></span></font></div>
</blockquote></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><span class="Apple-style-span" style="background-color: rgb(102, 255, 153);"><br>
</span></span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><span class="Apple-style-span" style="background-color: rgb(102, 255, 153);">Bad:</span></span></font></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><span class="Apple-style-span" style="border-collapse: separate; font-family: arial; "><div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">
<font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><span class="Apple-style-span" style="font-size: 13px; "><span class="Apple-style-span" style="background-color: rgb(102, 255, 153);">doSomething(myData, true, 0, false, true);</span></span><span class="Apple-style-span" style="background-color: rgb(102, 255, 153);"><br>
</span></span></font><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse; "><span class="Apple-style-span" style="background-color: rgb(102, 255, 153);">doSomething(param1, localBool1 &amp;&amp; (localBool2 || localBool3));</span></span></font></div>
</blockquote></div></span></span></font></div><div><br></div><div><b>Classes/Structs</b></div><div><span class="Apple-style-span" style="background-color: rgb(102, 255, 153);">There should not be a</span> blank line before the first item in class/structs. Add a blank line before public:, protected:, and private: otherwise.  No blank line after them.</div>
<div><br></div><div>Each section should be defined only once, and they should be in the order public:, protected:, and private:.</div><div><br></div><div>One class per file. Ideally one struct per file too, but sometimes small structs that are only used in a cpp file may be in place.</div>
<div><br></div><div><b>Constants</b></div><div><b><span style="font-family:arial, sans-serif;font-weight:normal;font-size:13px;border-collapse:collapse"><span class="Apple-style-span" style="background-color: rgb(102, 255, 153);">Constant variables</span> should be named just like a variable and have no special prefix</span></b></div>
<div><b><font face="arial, sans-serif"><span style="border-collapse:collapse;font-weight:normal"><br></span></font></b></div><div><b>Line length</b></div><div><span class="Apple-style-span" style="background-color: rgb(102, 255, 153);">There is no line length limit.  However, at about 120-180 characters, the line is getting long and you may want to consider wrapping it.</span></div>
<div><br></div><div><b>Braces</b></div><div>There should be at least one space after a brace and one space before a closing brace (when there are any characters before or after them respectively including another brace).</div>
<div><b><br></b></div><div><b>#include statements</b></div><div>All ifdef&#39;ed includes should be in a section after all other includes. Don&#39;t use ifdef&#39;s around includes if you don&#39;t need to.  For example, if you include a header that has if ENABLE(FEATURE) around its contents, you don&#39;t need to repeat the if ENABLE when including it.</div>
<div><b><span style="font-weight:normal"><div><b><br></b></div><div><b>#if<span class="Apple-style-span" style="background-color: rgb(102, 255, 153);">(def)</span> statements</b></div><div>If an #if<span class="Apple-style-span" style="background-color: rgb(102, 255, 153);">(def)</span> spans more than a few lines, end it like this:</div>
<div><font face="&#39;courier new&#39;, monospace">  #endif // WhateverWasInThe<span class="Apple-style-span" style="background-color: rgb(102, 255, 153);">If</span></font></div>

<div><br></div><div><b>Namespaces</b></div><div>If a namespace spans more than a few lines, end it like this</div><div><font face="&#39;courier new&#39;, monospace">  } // namespace NameOfNamespace</font></div><div><font face="&#39;courier new&#39;, monospace"><br>


</font></div></span></b></div><div><b>Misc</b></div><div><font face="&#39;courier new&#39;, monospace"><span style="font-family:arial">

<div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">Files should end with <span class="Apple-style-span" style="background-color: rgb(102, 255, 153);">a trailing</span> newline.</span></div>
</span></font></div></blockquote></div>








































<div><font face="arial, helvetica, sans-serif"><span style="font-family:arial"><div><br></div><div><br></div><div><span class="Apple-style-span" style="font-size: large;">Removed</span></div><div><span class="Apple-style-span" style="font-size: large;"><br>
</span></div><div><span class="Apple-style-span" style="font-size: large;"><span class="Apple-style-span" style="font-size: small; "><div><font face="&#39;courier new&#39;, monospace"><span style="font-family: arial; "><div>
<blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><b><span class="Apple-style-span" style="background-color: rgb(255, 102, 102);">Misc</span></b><div><span class="Apple-style-span" style="background-color: rgb(255, 102, 102);">Do not use static initializers for classes/structs.  Use DEFINE_STATIC_LOCAL instead (or </span><span class="Apple-style-span" style="background-color: rgb(255, 102, 102);">AtomicallyInitializedStatic if the initialization should be threadsafe).</span></div>
</blockquote></div><div>Reason: This is more of a coding guideline and should have likely have its own document like RefPtr. </div><div><br></div></span></font></div></span></span></div><div><div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">
<b><span class="Apple-style-span" style="background-color: rgb(255, 102, 102);">Indentation</span></b><div><span class="Apple-style-span" style="background-color: rgb(255, 102, 102);">Additional clauses in a conditional may be indented 4 extra spaces to visually separate them from the statement to be executed.</span></div>
<div><span class="Apple-style-span" style="background-color: rgb(255, 102, 102);"><br></span></div><div><span class="Apple-style-span" style="background-color: rgb(255, 102, 102);"><br></span></div><div><span class="Apple-style-span" style="background-color: rgb(255, 102, 102);">Like this</span></div>
<font face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="background-color: rgb(255, 102, 102);">if (condition1</span></font><div><font face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="background-color: rgb(255, 102, 102);">        &amp;&amp; condition2)</span></font></div>
<div><blockquote style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">
<div><font face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="background-color: rgb(255, 102, 102);">    statement;</span></font></div></blockquote></div></blockquote></div></div></span></font></div>
<div><font class="Apple-style-span" face="arial, helvetica, sans-serif"><span class="Apple-style-span" style="font-family: arial; ">Reason:</span> Currently not widely agreed upon.</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif"><br>
</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif"><span class="Apple-style-span" style="font-size: large;">Unaddressed items from the discussion</span></font></div>
<div><font class="Apple-style-span" face="arial, helvetica, sans-serif"><span class="Apple-style-span" style="font-size: large;"><br></span></font></div><div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">
<font class="Apple-style-span" face="arial, helvetica, sans-serif"><span class="Apple-style-span" style="background-color: rgb(255, 255, 102);">Changing the rules around when to include { } around items.</span></font></blockquote>
</div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif">Reason: I&#39;m not attempting to change anything here. Just trying to document widely accepted rules that aren&#39;t written in the current style guide.</font></div>
<div><font class="Apple-style-span" face="arial, helvetica, sans-serif"><span class="Apple-style-span" style="font-family: arial; "><div><blockquote class="webkit-indent-blockquote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">
<font class="Apple-style-span" face="arial, helvetica, sans-serif"><br><span class="Apple-style-span" style="background-color: rgb(255, 255, 102);">Naming for non-const globals.  </span></font></blockquote></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif">Reason: There isn&#39;t consensus around this right now. It sounds like several people would like to have a standard here, so please start a conversation for this (and the naming of statics in classes).</font></div>
</span></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Thanks,</font></div><div><font face="arial, helvetica, sans-serif">Dave</font></div>

</div>
</div><br></div>