I’m reading a lot about “typedef functions”, but I getting casting errors when I try to call this one. What’s the correct syntax to call this function?
typedef ::com::Type* Func(const char* c, int i);
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There’s no function in your code. There’s only a type name
Functhat stands for function type. There’s nothing to call there.The name
Func, as defined in your question, can be used in several different ways.For example, you can use it to declare a function
The above is equivalent to declaring
This will also work for member function declarations. (However, you can’t use it to define a function).
For another example, you can use it when declaring a pointer to a function, by adding an explicit
*The above is equivalent to declaring
For yet another example, you can use it as a parameter type in another function
in which case the function type will automatically decay to function pointer type, meaning that the above declaration of
baris equivalent toand equivalent to
And so on.
In other words, show us what your are trying to do with it. As is your question is too broad to be answered specifically.