diff options
author | Marc Schink <dev@zapb.de> | 2021-04-02 11:17:00 +0200 |
---|---|---|
committer | Antonio Borneo <borneo.antonio@gmail.com> | 2021-04-11 21:27:34 +0100 |
commit | 134d7d5a5876a53a10ecb2eeac8d193bdddcea81 (patch) | |
tree | 0e490b95a24c4fc7d3edb85ca8e25c87d6ed4ade /doc | |
parent | 96aaa77f72a721f058f3863f270c2ba3d8d68871 (diff) | |
download | riscv-openocd-134d7d5a5876a53a10ecb2eeac8d193bdddcea81.zip riscv-openocd-134d7d5a5876a53a10ecb2eeac8d193bdddcea81.tar.gz riscv-openocd-134d7d5a5876a53a10ecb2eeac8d193bdddcea81.tar.bz2 |
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 <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6132
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/manual/style.txt | 4 |
1 files changed, 2 insertions, 2 deletions
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 |