mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 23:03:27 +08:00
Documentation/NuttXCCodingStandard.html: Another small change discouraging the practice of enclosing the value argument of 'return' statements in parentheses.
This commit is contained in:
@@ -87,7 +87,7 @@
|
|||||||
<h1><big><font color="#3c34ec">
|
<h1><big><font color="#3c34ec">
|
||||||
<i>NuttX C Coding Standard</i>
|
<i>NuttX C Coding Standard</i>
|
||||||
</font></big></h1>
|
</font></big></h1>
|
||||||
<p>Last Updated: July 5, 2019</p>
|
<p>Last Updated: July 6, 2019</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@@ -2092,7 +2092,14 @@ ptr = (FAR struct somestruct_s *)value;
|
|||||||
As a rule of thumb, the length of a function should be limited so that it would fit on a single page (if you were to print the source code).
|
As a rule of thumb, the length of a function should be limited so that it would fit on a single page (if you were to print the source code).
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<b>Space after the function body</b>
|
<b>Return Statement</b>.
|
||||||
|
The argument of the <code>return</code> statement should <i>not</i> be enclosed in parentheses.
|
||||||
|
A reasonable exception is the case where the returned value argument is a complex expression and where the parentheses improve the readability of the code.
|
||||||
|
Such complex expressions might be Boolean expressions or expressions containing conditions.
|
||||||
|
Simple arithmetic computations would not be considered <i>complex</i> expressions.
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<b>Space after the function body</b>.
|
||||||
A one (and only one) blank line must follow the closing right brace of the function body.
|
A one (and only one) blank line must follow the closing right brace of the function body.
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -2121,7 +2128,7 @@ ptr = (FAR struct somestruct_s *)value;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return e / a;
|
return (e / a);
|
||||||
}
|
}
|
||||||
</ul></pre></font>
|
</ul></pre></font>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
|
|||||||
Reference in New Issue
Block a user