Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 8.8 Does this apply to after pre-processing
#1
Is the following code compliant with rule 8.9 “An object should not be defined at block scope if its identifier only appears in a single function”?
Code:
#define MACHINE1 0
int32_t x;   /* compliant or not? */

void fn1 ( void )
{
   x = 3;
}

int32_t fn2 ( void )
{
#if ( MACHINE1 )
   return x;
#else
   return 0;
#endif
}
Posted by and on behalf of the MISRA C Working Group


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)