C Coding Standard: Clarify the form of structures and unions declared with local variable definition.
This commit is contained in:
parent
6e3ced4111
commit
d5c91f9a57
@ -12,7 +12,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: June 18, 2017</p>
|
<p>Last Updated: August 7, 2017</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@ -1357,7 +1357,15 @@ typedef int myinteger_t;
|
|||||||
<b>No un-named structures</b>.
|
<b>No un-named structures</b>.
|
||||||
All structures must be named, even if they are part of a type definition.
|
All structures must be named, even if they are part of a type definition.
|
||||||
That is, a structure name must follow the reserved word <code>struct</code> in all structure definitions.
|
That is, a structure name must follow the reserved word <code>struct</code> in all structure definitions.
|
||||||
The exception to this rule is for structures that are defined within another union or structure (discouraged). In those cases, the structure name should always be omitted.
|
There are two exceptions to this rule:
|
||||||
|
<ol>
|
||||||
|
<li>
|
||||||
|
First for structures that are defined within another union or structure (discouraged). In those cases, the structure name should always be omitted.
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Second for structures as the type of a local variable. In this case, again, the structure name should always be ommitted.
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<b>Structured defined with structures discouraged</b>.
|
<b>Structured defined with structures discouraged</b>.
|
||||||
|
Loading…
Reference in New Issue
Block a user