What is the value of the typedef function int (void *)?

I saw some BSD code using the following construct:

typedef int driver_filter_t(void*);

What does it mean? I don’t think this is a pointer to a function, because otherwise it will be something like typedef int (*driver_filter_t)(void*), right?

+4
source share
2 answers
typedef int driver_filter_t(void*);

This is a function type definition. It makes an driver_filter_talias for the type, which can be described as "a function that returns inta type pointer with an argument void."

As with all typedefs, it creates an alias for the existing type, and not for the new type.

driver_filter_t . - driver_filter_t ( typedef). , :

driver_filter_t *func_ptr;

, * , , typedef , :

typedef int (*driver_filter_pointer)(void*);

typedefs , .

+8

typedef int driver_filter_t(void*); typedef . C , driver_filter_t* fn_ptr.

++ typedef - ( ):

struct Some {
    driver_filter_t foo; // int foo(void*);
    driver_filter_t bar; // int bar(void*);
};
+1

Source: https://habr.com/ru/post/1543440/


All Articles