AUTOSAR C++14 Rule A21-8-1
Arguments to character-handling functions shall be representable as an unsigned char
Description
Rule Definition
Arguments to character-handling functions shall be representable as an unsigned char.
Rationale
You cannot use plain char
variables as arguments to
character-handling functions declared in <cctype>
, for
instance, isalpha()
or isdigit()
. On certain
platforms, plain char
variables can have negative values that
cannot be represented as unsigned char
or EOF, resulting in
undefined behavior.
Polyspace Implementation
The check raises a flag when you use a signed or plain char
variable with a negative value as argument to a character-handling function.
Troubleshooting
If you expect a rule violation but Polyspace® does not report it, see Diagnose Why Coding Standard Violations Do Not Appear as Expected.
Check Information
Group: Strings library |
Category: Required, Automated |
Version History
Introduced in R2019a