Changes between Version 22 and Version 23 of CodeStyle
- Timestamp:
- 11/16/17 15:08:56 (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
CodeStyle
v22 v23 78 78 79 79 This makes the intent immediately clear to the reader / reviewer. 80 81 = Portability concerns = 82 83 == Printing time_t values == 84 85 POSIX specifies that time_t is an integer type but does not specify its size. The underlying type might be "int", "long" or "long long", some might make it unsigned too. This makes it hard to portably print time_t values using printf-like APIs, as a mismatch between the format string and the actual time_t size can lead to crashes or bogus representations. The safest way is to print those values as long long, which is at least 64 bits wide. 86 87 {{{#!c 88 time_t now = time(NULL); 89 printf("%lld seconds\n", (long long)now); 90 }}} 80 91 81 92 = Crustify rules =