... | ... | @@ -1139,7 +1139,10 @@ static int wait_for_read(int socket, uint32_t timeout_ms) { |
|
|
- This helps during unit-testing
|
|
|
- Avoid using more than 5 `{}` brace levels in your code
|
|
|
* Use [**Yoda notation**](https://knowthecode.io/yoda-conditions-yoda-not-yoda) in equality checks but not anywhere else.
|
|
|
* Example: `if (5 == value)` instead of `if (value == 5)`
|
|
|
* Example: Use `if (5 == value)` instead of `if (value == 5)`
|
|
|
* Example: Use `if (const_x != value)` instead of `if (value != const_x)`
|
|
|
* Example: Do not use `if (5 < value)`; see [**Yoda notation**](https://knowthecode.io/yoda-conditions-yoda-not-yoda)
|
|
|
* Example: Do not use `if (10 >= value)`; see [**Yoda notation**](https://knowthecode.io/yoda-conditions-yoda-not-yoda)
|
|
|
* Because we don't want to accidentally assign the variable in the condition check.
|
|
|
* Even though static analysis should catch this, we do not want to rely on it.
|
|
|
```c
|
... | ... | |