Rules:
5.2.a. Whenever the width, in bits or bytes, of an integer value matters in the program, one of the fixed width data types shall be used in place of char, short, int, long, or long long. The signed and unsigned fixed-width integer types shall be as shown in the table below.
Integer Width | Signed Type | Unsigned Type |
8 bits | int8_t | uint8_t |
16 bits | int16_t | uint16_t |
32 bits | int32_t | uint32_t |
64 bits | int64_t | uint64_t |
5.2.b. The keywords short and long shall not be used.
5.2.c. Use of the keyword char shall be restricted to the declaration of and operations concerning strings.
Example: See Appendix D.
Reasoning:
The C90 standard purposefully allowed for implementation-defined widths for char, short, int, long, and long long types, which has resulted in code portability problems. The C99 standard did not resolve this but did introduce the type names shown in the table, which are defined in the stdint.h header file.
See also Portable Fixed-Width Integers in C:
barrgroup.com/embedded-systems/how-to/c-fixed-width-integers-c99
In the absence of a C99-compatible compiler, it is acceptable to define the set of fixed-width types in the table above as typedefs built from underlying types. If this is necessary, be sure to use compile-time checking (e.g., static assertions).
Enforcement:
At every build an automated tool shall flag any use of keywords short or long. Compliance with the other rules shall be checked during code reviews.