This is an automated email from Gerrit. Marc Schink ([email protected]) just uploaded a new patch set to Gerrit, which you can find at http://openocd.zylin.com/6132
-- gerrit commit 631629f13b6d4b1433fb35c7db26f1cc52d2e306 Author: Marc Schink <[email protected]> Date: Fri Apr 2 11:17:00 2021 +0200 doc/manual/style: Do not use 'Yoda conditions' For more details, see: https://en.wikipedia.org/wiki/Yoda_conditions https://sektorvanskijlen.wordpress.com/2019/05/16/conditional-inversion-very-harmful-myth/ Change-Id: If1a8a5f1d0fd345b7cc0c7b5dee6d0d47f9d7fc2 Signed-off-by: Marc Schink <[email protected]> diff --git a/doc/manual/style.txt b/doc/manual/style.txt index dad3bb4..c3fcfd7 100644 --- a/doc/manual/style.txt +++ b/doc/manual/style.txt @@ -135,13 +135,13 @@ should write statements like the following: @code // separate statements should be preferred result = foo(); -if (ERROR_OK != result) +if (result != ERROR_OK) ... @endcode More directly, do @b not combine these kinds of statements: @code // Combined statements should be avoided -if (ERROR_OK != (result = foo())) +if ((result = foo()) != ERROR_OK) return result; @endcode --
