functions' pointer

G

gio

Can I have a definition of a pointer to a generic function ?

whitout specifing the type and number of the arguments?

Something like this can work?

void * (*fptr) (...);

I have read somewhere that I must specify at least the first argument
type. Is it true?

Thanks
 
F

Flash Gordon

gio wrote, On 17/03/07 18:18:
Can I have a definition of a pointer to a generic function ?
No.

whitout specifing the type and number of the arguments?

Something like this can work?

void * (*fptr) (...);

Well, if you know the return type and it is only the parameter lists
which are different, and if not of them are varidac functions and if the
default argument promotions will give the correct types, you can use:
returntype (*fptr)();
However, if you do not pass the number and type (after promotion) of
arguments the actual function you are calling is defined as taking then
the behaviour is undefined, so anything can happen, with the most likely
result being hard to find bugs.
I have read somewhere that I must specify at least the first argument
type. Is it true?

That is true for varidac functions (ones using ...).

What is your real problem rather than what you think the solution might be?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,149
Latest member
Vinay Kumar Nevatia0
Top