| methodos (58) | |
|
Hi all, 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? | |
|
|
|
| firedraco (5495) | |
| It's a function pointer. The macro only defines the name and the return type, the parameters are attached. | |
|
|
|
| Stewbond (1843) | |||
|
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: typedef double (*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:
In your example: ExtPluginType is now exactley like our p_func in the simple example above. It lets us define a pointer to a function. | |||
|
Last edited on
|
|||
| methodos (58) | |
| Thanks a lot. That is exactly the answer I didn't know I was looking for :) | |
|
|
|