14-09-2018, 07:28 AM
I have the folowing code :
And FlexeLint for C/C++ (Unix) Vers. 9.00L gives me he following message:
uint16_t const MY_varTotal = (CONST1 + CONST2);
Note 9034: Expression assigned to a narrower or different essential type [MISRA 2012 Rule 10.3, required]
[/code]
I do not understand the reasoning why rule 10.3 is violated.
Code:
#define CONST1 556U
#define CONST2 420U
uint16_t const MY_var1 = CONST1;
uint16_t const MY_var2 = CONST2;
uint16_t const MY_varTotal = (CONST1 + CONST2);
And FlexeLint for C/C++ (Unix) Vers. 9.00L gives me he following message:
uint16_t const MY_varTotal = (CONST1 + CONST2);
Note 9034: Expression assigned to a narrower or different essential type [MISRA 2012 Rule 10.3, required]
[/code]
I do not understand the reasoning why rule 10.3 is violated.
<t></t>