Add style rule to avoid combining assignment and logical tests.
[fw/openocd] / doc / manual / style.txt
index b9a7612f0e85225e1b1bda4827f51672a36e403a..0fe33876e8c9fac3f7956a59a7bea54498b1eca9 100644 (file)
@@ -106,6 +106,20 @@ int f(int x1, int x2)
        int y = f(x1, x2 - x1);
        ...
 }
+@endcode
+- Separate assignment and logical test statements.  In other words, you
+should write statements like the following:
+@code
+// separate statements should be preferred
+result = foo();
+if (ERROR_OK != result)
+       ...
+@endcode
+More directly, do @b not combine these kinds of statements:
+@code
+// Combined statements should be avoided
+if (ERROR_OK != (result = foo()))
+       return result;
 @endcode
 
  */