diff options
author | Ian Moffett <ian@osmora.org> | 2025-04-18 23:02:32 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-04-18 23:02:32 -0400 |
commit | 6453151425085f2f1ef9edd24a6941c9a0b49c67 (patch) | |
tree | 5403865acc22336bb62fa2138dfafd70a879a916 | |
parent | b57c6bc906b991c2ac71422508bf603db4f96abc (diff) |
share: contrib: Add note about local variablesexpt
Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r-- | share/misc/contrib | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/share/misc/contrib b/share/misc/contrib index 1560f37..a36c127 100644 --- a/share/misc/contrib +++ b/share/misc/contrib @@ -21,6 +21,22 @@ is_power_of_two(uint8_t n) return ((n & 0x01) == 0); } +-- +When defining local variables in functions, they +must be declared at the top: + +static void +foo(void) +{ + uint8_t byte; + uint16_t pair; + uint32_t quad; + uint64_t oct; + + ... +} +-- + When checking if an integer is 0 or not, *be explicit* unless it is a bool! Do not do this: |