T
Timothy Madden
[Cross-posted to: comp.lang.c, comp.lang.c++]
Hello all
I'm facing a very strange problem. I need to define a function that takes as
argument something like a pointer to itself. It takes as argument a pointer
of the same type as a pointer to itself and with possibly other
pointer-to-function value. But I don't have a data type for such a pointer
because the function prototype is in the same time being defined. I hope you
are following me ...
Actualy I need to define a pointer to a function. Different modules of my
app will install a new function to be pointed by this pointer, and each new
function will remember the address of and call the previous function,
forming a chain that exists only in code. I guess the idea is used for
at_exit() function in the library or something like it.
Now I want the function to take as argument a pointer to another instance of
the same function type. This will allow for removing functions from the
chain even in a different order than the one functions were installed, by
having each installed function recognize it's own address in the argument
and then return as a result the previous installed function that it knows of
I hope you are following me...
So how could I declare the prototype for a function that takes as argument
and that returns a pointer to the same function type being declared ?
Thank you
Timothy Madden
Romania
Hello all
I'm facing a very strange problem. I need to define a function that takes as
argument something like a pointer to itself. It takes as argument a pointer
of the same type as a pointer to itself and with possibly other
pointer-to-function value. But I don't have a data type for such a pointer
because the function prototype is in the same time being defined. I hope you
are following me ...
Actualy I need to define a pointer to a function. Different modules of my
app will install a new function to be pointed by this pointer, and each new
function will remember the address of and call the previous function,
forming a chain that exists only in code. I guess the idea is used for
at_exit() function in the library or something like it.
Now I want the function to take as argument a pointer to another instance of
the same function type. This will allow for removing functions from the
chain even in a different order than the one functions were installed, by
having each installed function recognize it's own address in the argument
and then return as a result the previous installed function that it knows of
I hope you are following me...
So how could I declare the prototype for a function that takes as argument
and that returns a pointer to the same function type being declared ?
Thank you
Timothy Madden
Romania