Add style rule to avoid combining assignment and logical tests.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2503 b42882b7-edfa-0310-969c-e2dbd0fdcd60
__archive__
zwelch 2009-07-08 22:26:42 +00:00
parent eaa895a0b2
commit 3cf4717a2a
1 changed files with 14 additions and 0 deletions

View File

@ -106,6 +106,20 @@ int f(int x1, int x2)
int y = f(x1, x2 - x1); 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 @endcode
*/ */