Re: Function pointer prototype interpretation




Alfonso Morra wrote:
> Hi all,
>
> I came accross this FP signature and it has me baffled.
>
> Can anyone explain this signature to me - i.e what are the input and
> output types ?
>
> void(*(*foo)(int))(int,void(*)(int))
>
> Thanks

foo -- foo
*foo -- is a pointer
(*foo)() -- to a function
(*foo)(int) -- taking one int parameter
*(*foo)(int) -- returning a pointer
(*(*foo)(int))() -- to a function
(*(*foo)(int))(int, void(*)(int)) -- taking two parameters,
one int and the other
a pointer to a function
taking one int parameter
and returning void
void (*(*foo)(int))(int, void(*)(int)) -- returning void

To summarize, foo is a pointer to a function that returns a pointer to
a function that returns void.

.



Relevant Pages

  • Re: pointer questions
    ... In C you can convert a pointer to any function ... signature to make the call. ... a formal parameter of such a narrow type actually uses the widened ... This allows you to create a data structure, such as a table, which has ...
    (comp.lang.ada)
  • Re: Function pointer prototype interpretation
    ... > I came accross this FP signature and it has me baffled. ... Did you try cdecl? ... declare foo as pointer to function returning pointer to function ...
    (comp.lang.c)
  • Re: convert string to hash of hash?
    ... The first argument to Nodeis a pointer to a pointer to a structure. ... incompatible signatures, then you loose information. ... "signature" meaning the specific sequence of the argument types, ...
    (comp.lang.perl.misc)
  • Re: Passing method pointer
    ... the this pointer) in which case it would have the right signature, ... or use Marshal::GetFunctionPointerForDelegate to create a trampoline ... The illegal memory read occures *before* the ReadStream() method returns. ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Function pointer prototype interpretation
    ... > I came accross this FP signature and it has me baffled. ... declare foo as pointer to function returning pointer to function (int, ... pointer to function returning void) returning void ...
    (comp.lang.c)