version 1.1, 2013/01/21 13:43:51
|
version 1.2, 2013/02/18 14:33:40
|
|
|
<em>Approved version (Ballot 160).</em> | <em>Approved version (Ballot 160).</em> |
</td> | </td> |
</tr> | </tr> |
|
<tr> |
|
<td align="center">3.4</td> |
|
<td align="center">22 January 2013</td> |
|
<td align="center">Marek Szermutzky</td> |
|
<td>Adding section on Unused's (variables, |
|
arguments, values etc.)</td> |
|
</tr> |
</table> | </table> |
<p> </p> | <p> </p> |
<hr> | <hr> |
|
|
declarations and definitions.</li> | declarations and definitions.</li> |
</ol> | </ol> |
| |
|
<h3>Avoiding Unused parameter, variables, values, functions ...</h3> |
|
<p>In general, avoid unused variables, parameters, values and |
|
functions. Many compiler come with support to automatically detect |
|
these, use them. The OpenPegasus build using gcc will flag unused variables |
|
as errors. |
|
The Pegasus Architecture team may completely disallow checkin of code that |
|
generates unused* warnings to CVS in the future.<br> |
|
</p> |
|
<ol> |
|
<li>Avoid unused parameter warnings. In case the function |
|
signature cannot be changed since the function codes an |
|
interface, leave the parameter name off in the function |
|
definition while keeping the parameter type in place. In the |
|
following example of function <i>main()</i> the parameter <i>argv</i> |
|
is used later on but parameter <i>argc</i> is not. Do this:<br> |
|
<pre><code>int main(int, void** argv) |
|
{ |
|
};</code></pre> |
|
Not this:<br> |
|
<pre><code>int main(int argc, void** argv) |
|
{ |
|
};</code></pre> |
|
</li> |
|
</ol> |
|
|
| |
<h2><font color="#000000">Discussion</font></h2> | <h2><font color="#000000">Discussion</font></h2> |
<p>Suggestions for additional conventions are listed here for discussion: | <p>Suggestions for additional conventions are listed here for discussion: |