MISRAC++2023-7.0.6_a
In this section:
Synopsis
(Required) Assignment between numeric types shall be appropriate
Enabled by default
Yes
Severity/Certainty
Medium/Medium

Full description
Inappropriate assignment found causing implicit cast
Coding standards
This check does not correspond to any coding standard rules.
Code examples
The following code example fails the check and will give a warning:
void example() {
unsigned char c = 300u;
}
The following code example passes the check and will not give a warning about this issue:
void example() {
unsigned short n = 300u;
}