How do I prototype this?
Kevin D. Quitt
kdq at demott.COM
Tue Jun 26 08:39:50 AEST 1990
I'm invoking functions through an array of struct. My compiler generates
a warning in the following two cases. How do I declare prototypes given:
---------------- Example 1
-------** in the .h file:
struct token_def
{
u16 index;
u16 match; /* # of chars to match, 0 = all */
u8 name[16];
i16 (*fn)(); /* Function to call */
};
-------** in the configuration file:
struct token_def configuration[] =
{
{ TITLES, 0, "TITLES", paint_titles },
{ REPAINT, 0, "REPAINT", collect_repaints },
{ PBLOCK, 7, "PBLOCK_", define_pblock },
{ TBLOCK, 7, "TBLOCK_", define_tblock },
{ UPPER, 0, "UPPER", define_upper_platen },
{ LOWER, 0, "LOWER", define_lower_platen },
{ TOOL, 0, "TOOL", define_tool_probes }
};
-------** in the code file:
extern struct token_def configuration[];
----** then, this:
(*configuration[ tnum ].fn)( cfg, token );
----** gets:
pm.c(330) : warning C4071: 'configuration' : no function prototype given
----------------------------------------------------------------
#2
struct parse_info
{
CMD_IN *pici; /* Ptr to command input struct */
u16 piexcl; /* Boolean - exclusive command list */
u8 *piparam; /* Ptr to parameter string */
u16 piplen; /* Length of parameter(s) */
};
#define MAX_PARSE_DEPTH (16)
local struct parse_info pi[ MAX_PARSE_DEPTH ];
----** this:
(*(pi[0].pici->func))();
----** gets:
input.c(762) : warning C4071: 'function through ptr' : no function prototype given
Note also that depending upon the circumstances, the call will have
zero, one or two parameters.
--
_
Kevin D. Quitt demott!kdq kdq at demott.com
DeMott Electronics Co. 14707 Keswick St. Van Nuys, CA 91405-1266
VOICE (818) 988-4975 FAX (818) 997-1190 MODEM (818) 997-4496 PEP last
96.37% of all statistics are made up.
More information about the Comp.lang.c
mailing list