diff options
Diffstat (limited to 'CODING_STYLE')
-rw-r--r-- | CODING_STYLE | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/CODING_STYLE b/CODING_STYLE index cb8d96c4cb..e192944124 100644 --- a/CODING_STYLE +++ b/CODING_STYLE @@ -41,11 +41,11 @@ - Don't synchronously talk to any other service from PID 1, due to risk of deadlocks -- Avoid fixed sized string buffers, unless you really know the maximum +- Avoid fixed-size string buffers, unless you really know the maximum size and that maximum size is small. They are a source of errors, - since they possibly result in truncated strings. Often it is nicer - to use dynamic memory, alloca() or VLAs. If you do allocate fixed - size strings on the stack, then it's probably only OK if you either + since they possibly result in truncated strings. It is often nicer + to use dynamic memory, alloca() or VLAs. If you do allocate fixed-size + strings on the stack, then it's probably only OK if you either use a maximum size such as LINE_MAX, or count in detail the maximum size a string can have. (DECIMAL_STR_MAX and DECIMAL_STR_WIDTH macros are your friends for this!) @@ -99,7 +99,7 @@ - Unless you allocate an array, "double" is always the better choice than "float". Processors speak "double" natively anyway, so this is - no speed benefit, and on calls like printf() "float"s get upgraded + no speed benefit, and on calls like printf() "float"s get promoted to "double"s anyway, so there is no point. - Don't invoke functions when you allocate variables on the stack. Wrong: |