I'd say that there's no reason to declare functions inside a function as it gives the false impression that it's somehow limited to that function alone while it isn't.
Functions have external linkage (besides your code specifically has extern
for function vFullDemoIdleHook()
) by default and declaring inside functions should be considered as a bad practice (but valid though).
Prototypes should be in a header file (or at the top of the source file if there's no header). I'd move the declaration to main_full.h
:
extern void vFullDemoIdleHook( void ); /* extern keyword is redundant here */
main_full.c:
void vApplicationIdleHook( void )
{
/* The simple blinky demo does not use the idle hook - the full demo does. */
#if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 )
{
//* Implemented in main_full.c. */
vFullDemoIdleHook();
}
#endif
}
Unless you intend to use the same function name vFullDemoIdleHook
for a different purpose (which would be terrible), you don't need to conditionally (#if
) declare function prototypes.