diff options
author | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-10-17 04:24:29 +0000 |
---|---|---|
committer | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-10-17 04:24:29 +0000 |
commit | 872fa0e9c974d57d7dc373a39e0fd96214389855 (patch) | |
tree | 063abe71d81685af5f4e7e96e2ffd68b7b641964 | |
parent | 5131a25a9e8d66b9e73124d1d5f6f6afc01cda2e (diff) | |
download | ATCD-872fa0e9c974d57d7dc373a39e0fd96214389855.tar.gz |
1) use complete sentences for comments and 2) use prefix operators
where possible, such as on an iteration loop index.
-rw-r--r-- | docs/ACE-guidelines.html | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/docs/ACE-guidelines.html b/docs/ACE-guidelines.html index 707dafff283..d5ef982c678 100644 --- a/docs/ACE-guidelines.html +++ b/docs/ACE-guidelines.html @@ -64,7 +64,9 @@ bgcolor="#ffffff"> <li><strong>Code Documentation</strong><p> <ul> - <li>Use comments and whitespace (:-) liberally.<p> + <li>Use comments and whitespace (:-) liberally. Comments + should consist of complete sentences, i.e., start + with a captial letter and end with a period.<p> <li>Insert a CVS/RCS keyword string at the top of every source file, Makefile, config file, <em>etc</em>. For C++ files, it is: @@ -208,7 +210,27 @@ bgcolor="#ffffff"> // Terminate this string. file_name [i] = '\0'; - </pre> + </pre><p> + + <li>Prefix operators are sometimes more efficient than postfix + operators. Therefore, they are preferred over their postfix + counterparts where the expression value is not used.<p> + + Therefore, use this idiom for iterators, with prefix operator + on the loop index: + <pre> + ACE_Ordered_MultiSet<int> set; + ACE_Ordered_MultiSet_Iterator<int> iter(set); + + for (i = -10; i < 10; ++i) + set.insert (2 * i + 1); + + </pre> + rather than the postfix operator: + <pre> + for (i = -10; i < 10; i++) + set.insert (2 * i + 1); + </pre><p> <li>Avoid unnecessary parenthesis. We're not writing Lisp :-)<p> |