AUTOSAR C++14 Rule A3-9-1
R2026bFixed width integer types from <cstdint>, indicating the size and signedness, shall be used in place of the basic numerical types
Description
Fixed width integer types from <cstdint>, indicating the size and signedness, shall be used in place of the basic numerical types.
Polyspace Implementation
Only allows use of basic types through direct typedefs.
Rationale
The sizes of the basic numerical types such as char, signed
char, and unsigned char are implementation-defined and can
vary across platforms and compilers. Code that relies on these types directly may behave
differently depending on the target platform, making it non-portable and potentially
unsafe.
The fixed-width integer types from <cstdint> such as
std::int8_t and std::uint8_t have an explicit,
guaranteed size and signedness. Using them in place of the basic types makes the intent of
the code clear and ensures consistent behavior across platforms, which is critical for
safety-critical embedded and automotive software.
Troubleshooting
If you expect a rule violation but Polyspace® does not report it, see Diagnose Why Coding Standard Violations Do Not Appear as Expected.
Examples
Check Information
| Group: Basic Concepts |
| Category: Required, Automated |
PQL Name:
std.autosar_cpp14.A3_9_1 |