0

How can I fix this warning?

typedef void (*VF_A)(PST_A);  // Warning here: parameter names (without types) in function declaration

typedef struct ST_A_ {
    ...
    VF_A vf_a;
} ST_A, *PST_A;
e0k
  • 6,961
  • 2
  • 23
  • 30
zen
  • 3
  • 1

1 Answers1

0

This question is similar to Resolve circular typedef dependency?, but yours is slightly different in that you have a pointer to a function instead of a struct. Use the strategy from this answer.

The idea behind the problem is that you are trying to declare a new type and also define a struct at the same time. The solution is to separate these two:

typedef struct ST_A_ ST_A, *PST_A;  // PST_A points to some struct, defined later
typedef void (*VF_A)(PST_A);        // use PST_A to define VF_A
struct ST_A_ { VF_A vf_a; };        // now define the struct PST_A points to
Community
  • 1
  • 1
e0k
  • 6,961
  • 2
  • 23
  • 30