Consider this code:
typedef void (*f)(int, double);
foo(f ptr);
This generates two classes:
* f (the function pointer typedef)
* f$ptr (a copy of the function pointer class, seen from the parameter type of foo)
The second class is redundant, and arguably wrong, as it seems to suggest that the function pointer has been defined "inline", as follows:
void foo(void (*f)(int, double));
Which is obviously not the case.
typedef void (*f)(int, double);
foo(f ptr);
This generates two classes:
* f (the function pointer typedef)
* f$ptr (a copy of the function pointer class, seen from the parameter type of foo)
The second class is redundant, and arguably wrong, as it seems to suggest that the function pointer has been defined "inline", as follows:
void foo(void (*f)(int, double));
Which is obviously not the case.
- relates to
-
CODETOOLS-7903644 typedef of anonymous struct generates a redundant class
-
- Resolved
-