Question on MISRA C:2012- Rule 10.3 in polyspace code prover 2019a
Mostra commenti meno recenti
Assuming that I have the following structure and enum:
Code:
typedef struct s{
unsigned int a:5;
unsigned int b:1;
unsigned int c:1;
} s;
typedef enum e{
ZERO = 0,
ONE = 1,
TWO = 2,
THREE = 3
} e;
Why does the following code trigger rule 10.3?
Code:
s fcn(void)
{
s test;
test.a = (unsigned int) THREE; // MISRA C:2012 10.3 violation
test.a = (unsigned char) THREE; // MISRA C:2012 10.3 violation
return test;
}
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Polyspace Bug Finder in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!