Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 8.10 and init functions
#2
I think you have misunderstood the MISRA rule. It states:

"...if a function is only called from elsewhere within the same file, use static."

Your init function is not called from within the same file (module.c), it is called from main.c.
This rule only applies to cases with internal (private) functions:

Code:
static void _fiddleWithInternalVariables (void);

void initModule (void)
{
  /* ... */
  fiddleWithInternalVariables();
}

static void _fiddleWithInternalVariables (void)
{
  /* ... */
}

So just keep doing the way you have always done, since it is indeed good program design to give program modules private encapsulation.
<t></t>


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)