diff options
Diffstat (limited to 'share')
-rw-r--r-- | share/misc/contrib | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/share/misc/contrib b/share/misc/contrib index 6f93fb7..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: @@ -87,6 +103,14 @@ a pointer, like, for example: uint8_t *ptr = NULL; ... +-- +The preferred pointer style is: + +void *p = ...; + +-- Not: + +void* p = ...; -- or if you have for example, some sort of counter value that must have a start: |