I was browsing through an SDK (Filemaker plugin SDK) and stumbled upon the following code: #define FMX_PROCPTR(retType, name) typedef retType (*name)
In another header the macro was used as follows: FMX_PROCPTR( errcode, ExtPluginType ) ( short functionId, const ExprEnv& env, const DataVect& parms, Data& result );
Substituting the macro with its definition I would say this translates as: typedef errcode (*ExtPluginType) ( short functionId, const ExprEnv& env, const DataVect& parms, Data& result )
(Between the latter parantheses are several classes that are declared before this statement and the errcode type is defined in another header.)
I was wondering, is this a function and if so, what is the name of the function? Or is it a complicated type definition wich includes parameters? Or am I missing something here?
I don't think this is a function. It's a function pointer type.
It will let us define a pointer to any function that looks like this: errcod SomeFunction(short, const ExprEnv&, const DataVect&, Data&)
Let's take a simpler example: typedefdouble (*p_func)(double);
p_func is now a type that lets us define a pointer to a function that takes a double and returns a double. We can do some fun things now like: