Ada 95 Quality and Style Guide | Chapter 5 |
5.5.4 Positive Forms of Logicguideline
Avoid names and constructs that rely on the use of negatives.
Choose names of flags so they represent states that can be used in positive form. example
Use:
if Operator_Missing thenrather than either:
if not Operator_Found thenor:
if not Operator_Missing thenrationale
Relational expressions can be more readable and understandable when stated in a positive form. As an aid in choosing the name, consider that the most frequently used branch in a conditional construct should be encountered first.
exceptions
There are cases in which the negative form is unavoidable. If the relational expression better reflects what is going on in the code, then inverting the test to adhere to this guideline is not recommended.
< Previous Page | Search | Contents | Index | Next Page > |
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
TOC | TOC | TOC | TOC | TOC | TOC | TOC | TOC | TOC | TOC | TOC |
Appendix | References | Bibliography |