 |
| Data |
| [ ] | use the new integral types, such as int64_t, defined in <inttypes.h> |
| [ ] | inspect variables defined as int and long (sizes vary by platform) |
| [ ] | never cast pointers to integral data types that don't scale, such as ints or longs |
| [ ] | check that casts don't truncate data, including numeric constants |
| [ ] | don't do pointer arithmetic |
| [ ] | use sizeof and offsetof to access data structures rather than constant numeric offsets |
| [ ] | don't use hardcoded values for sizes of data types, bit shifts, or memory allocation |
| [ ] | avoid mixing data types in assignments and comparisons (implicit casting) |
| [ ] | avoid using fixed-size bit masks |
 |
| Functions |
| [ ] | use explicit function prototypes rather than letting parameters default to int or long |
| [ ] | use the constants defined in <inttypes.h> to select printf formatting options |
| [ ] | don't use in-line assembly (locate assembly code in a separate file and recode it for Itanium-based architecture) |
| [ ] | Be careful while using pointers or longs as function parameters or return values as sizes vary by platform. Explicitly including function prototypes for all the functions is recommended to alleviate the problem. |
 |
| General |
| [ ] | always use ANSI compilers |
| [ ] | use standard API calls to get system parameters |
| [ ] | use code guards (include #error to prevent drop-throughs) when code is platform-specific |
| [ ] | remove dead code |
| [ ] | inspect your hash implementation, especially if using pointers as keys (many algorithms expect 32-bit data) |
| [ ] | don't use self-modifying code |
| [ ] | avoid data-packing code |
| [ ] | use caution when storing or restoring on-disk structures |