<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Title" content="">
<meta name="Keywords" content="">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.msoIns
        {mso-style-type:export-only;
        mso-style-name:"";
        text-decoration:underline;
        color:teal;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body bgcolor="white" lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt">A summary of the discussion thread so far.  Not surprisingly, it’s all about the whitespace. :)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">The descriptions here were written to be understandable stand-alone.  Once we come to a conclusion, we’ll wordsmith them into the coding style.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Do not put a size after sizeof; do use parens.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">When breaking long lines, if there are Boolean conditionals, put them at the start of the line.  Consider doing this consistently, and don’t merge even if they fit.  For example:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">                some_long_condition()<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">                && short1() && short2()<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">should be three lines.  Related conditions should be on one line if they fit, else given an extra level of indent<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">                some_long_condition()<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">                    && (short1() || short2())<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">                    && some_other_flag != 0<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">If the expression for an if statement does not fit, indent the continuation lines an extra level<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">                if (this_is_true()<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">                        && !that_is_false()) {<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">                    code();<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">                    ….<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Try not to break long lines across a function call, but if you have to, indent the rest of the parameter list to be after the function’s opening paren.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Remember a blank line after variable declarations (even local ones).<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Treat a single-statement with comment as if it were multi-line and use curly braces<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">                if (test()) {<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">                    /* already alerted */<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">                    close();<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">                }<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Note that this could end up having “cascading curly” effects.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Arguments inside macro expansions should be parenthesized.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">                #define foo(a, b)  ((a) + (b))<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Free routines should properly handle null; don’t check for null before calling a free routine.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">When possible, use size_t for sizes of things (including array indicies)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">[ Matt said “initialize in the declaration if appropriate; can someone provide wording? ]<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">This is controversial, so maybe drop it.  Don’t use else after return or goto unless it makes the flow more clear.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Argument names in function definition should match the declaration, but you can use “unused_” as a prefix in the definition for unused arguments.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Use ossl_assert, not assert.  Do not forget to handle the error condition as asserts are not compiled into production code.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
</div>
</body>
</html>