|Ada 95 Quality and Style Guide||Chapter 5|
5.5.4 Positive Forms of Logic
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.
Use:if Operator_Missing then
rather than either:if not Operator_Found then
or:if not Operator_Missing then
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.
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 >|