Question about function pointers & prototypes
Tom Neff
tneff at bfmny0.UUCP
Sun Aug 27 02:28:18 AEST 1989
In article <1611 at agora.UUCP> rickc at agora.UUCP (Rick Coates) writes:
>I am using an array of pointers to functions to access procedures. My
>compiler complains about lacking a function prototype. Since the
>procedures take from none to four differing parameters, how do I declare it?
If the list of function pointers is such that the Nth entry is always
a function of a certain declaration, while the N+1th is always a function
of a certain OTHER declaration, etc., then it is probably better to use
a structure here than an array. The structure declaration will let you
provide explicit prototypes for the component function (pointers). If
one or more entries in the list really do take a variable number of
parameters, then the standard pANS "varargs" can be used in their
declaration within the structure.
This is a standard solution for installable drivers and the like.
--
"We walked on the moon -- (( Tom Neff
you be polite" )) tneff at bfmny0.UU.NET
More information about the Comp.std.c
mailing list