Synopsis: | Function pointer parameters should not be declared as ordinary pointer type. A type should be used which is declared by a "typedef" declaration. |
Language: | C |
Severity Level: | 6 |
Category: | External Definitions |
Description: |
Justification Improves readability. Example 1 /* WRONG example of function with parameters defined as pointer type. */ void CCBB_exec_test( int test_param_version_number, int (*input_fun)(bool, void *, void **, int *), int (*exec_fun)(void *), int (*normal_fun)(void)); Example 2 /* RIGHT example of function with parameters declared as non-pointer type */ /*-------------------------------------------------------------------------| | Module typedefinitions | |-------------------------------------------------------------------------*/ /* Type declarations of functions to be implemented */ typedef int(*input_funcptr)(bool use_params, void *input_p, void **output_pp, int *output_size_p ); typedef int (*exec_funcptr)(void *input_p); typedef int (*normal_funcptr)(void); /*-------------------------------------------------------------------------| | Module Exported functions | |-------------------------------------------------------------------------*/ void CCBB_exec_test( int test_param_version_number, input_funcptr input_func, exec_funcptr exec_func, normal_funcptr normal_func); |