02-12-2008, 02:33 PM
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:
So just keep doing the way you have always done, since it is indeed good program design to give program modules private encapsulation.
"...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>