MISRA C:2012 Rule 7.6
The small integer variants of the minimum-width integer constant macros shall not be used
Since R2025a
Description
Rule Definition
The small integer variants of the minimum-width integer constant macros shall not be used.1
Rationale
Minimum width integer constant macros of the form
INT
or n
_C(value
)UINT
are implementation dependent. Depending on your compiler, it is possible that the expansion
of these macros result in a full width integer type instead of the anticipated small integer
type. In this code, the variable n
_C(value
)var
might be a full-width signed integer
in some
implementations:
uint8_t var = UINT8_C( 100 );
Polyspace Implementation
Polyspace® reports a violation if you use a minimum-width integer constant macro that
represents an integer that is smaller than or equal to the size of int
in
your environment. For example, Polyspace reports a violation on these macros if your environment supports 32-bit integers:
INT8_C
,UINT8_C
INT16_C
,UINT16_C
If your environment supports 64-bit integers, Polyspace also reports the use of INT32_C
and
UINT32_C
.
Use of these tokens in a #define
statement is not a violation.
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: Literals and constants |
Category: Required |
AGC Category: Required |
Version History
Introduced in R2025a
1 All MISRA coding rules and directives are © Copyright The MISRA Consortium Limited 2021.
The MISRA coding standards referenced in the Polyspace Bug Finder™ documentation are from the following MISRA standards:
MISRA C:2004
MISRA C:2012
MISRA C:2023
MISRA C++:2008
MISRA C++:2023
MISRA and MISRA C are registered trademarks of The MISRA Consortium Limited 2021.