-
Type:
Code Smell Detection
-
Status: Active
-
Resolution: Unresolved
-
Labels:None
-
Message:Define and use a "typedef" for XXX
-
Default Severity:Critical
-
Impact:High
-
Likelihood:Low
-
Covered Languages:C, C++, Objective-C
-
Remediation Function:Constant/Issue
-
Constant Cost:15min
Function pointer syntax can be hard on the eyes, particularly when one function is used as a parameter to another. Providing and using a typedef instead (or a using in C++) can make code easier to read, and should be preferred.
Noncompliant Code Example
extern void (*signal(int, void(*)(int)))(int);
Compliant Solution
typedef void (*SignalHandler)(int signum); extern SignalHandler signal(int signum, SignalHandler handler);