Add style rule to avoid combining assignment and logical tests.
---
 style.txt |   14 ++++++++++++++
 1 file changed, 14 insertions(+)
Add style rule to avoid combining assignment and logical tests.
---
 style.txt |   14 ++++++++++++++
 1 file changed, 14 insertions(+)
======
only in patch2:
unchanged:
--- doc/manual/style.txt	(revision 2495)
+++ doc/manual/style.txt	(working copy)
@@ -107,6 +107,20 @@
 	...
 }
 @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
 
  */
 /** @page styledoxygen Doxygen Style Guide
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to