functions' pointer

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • gio

    #1

    functions' pointer

    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

  • Flash Gordon

    #2
    Re: functions' pointer

    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?
    --
    Flash Gordon

    Comment

    Working...