05-10-2011, 07:54 AM
Dear all,
below, you find code that shall be full MISRA-C:2004 compatible except MISRA rule 17.1 (according to my compiler). I removed the header file module.h for readability.
[code]
/* now module.c begins */
float32_t Defaults[6];
void misra17_1test(const float32_t in[6])
{
uint32_t s = 0u;
float32_t mythreshold = 0.0f;
float32_t tmpMax = 0.0f;
for (s = 0u; s < 6u; s++) {
mythreshold = in[s]; /* a MISRA 17.1 violation is detected here by compiler */
/* do something */
if (tmpMax > mythreshold) {
/* do something */
}
else {
/* do something */
}
}
}
*-----------------------------------------------------------------------------------------*/
/* now the main.c module begins */
extern float32_t Defaults[6];
int32_t main(void)
{
int32_t j = 0;
for(j=0; j
below, you find code that shall be full MISRA-C:2004 compatible except MISRA rule 17.1 (according to my compiler). I removed the header file module.h for readability.
[code]
/* now module.c begins */
float32_t Defaults[6];
void misra17_1test(const float32_t in[6])
{
uint32_t s = 0u;
float32_t mythreshold = 0.0f;
float32_t tmpMax = 0.0f;
for (s = 0u; s < 6u; s++) {
mythreshold = in[s]; /* a MISRA 17.1 violation is detected here by compiler */
/* do something */
if (tmpMax > mythreshold) {
/* do something */
}
else {
/* do something */
}
}
}
*-----------------------------------------------------------------------------------------*/
/* now the main.c module begins */
extern float32_t Defaults[6];
int32_t main(void)
{
int32_t j = 0;
for(j=0; j
<t></t>