I ran across a line of code that looks like the following:
typedef Foo* (*CREATE_BAR)(uint32_t);
How exactly does this work? What is happening in this code?
I ran across a line of code that looks like the following:
typedef Foo* (*CREATE_BAR)(uint32_t);
How exactly does this work? What is happening in this code?
It's a function pointer type named CREATE_BAR
which accepts a uint32_t
argument and returns a Foo*
. It could hold a pointer to any such function.
It is a type for a pointer on function returning Foo*
, and taking uint32_t
In c++11, it would be
using CREATE_BAR = Foo* (*)(uint32_t);