d85_kitte@tekn01.chalmers.se (Kristian Wedberg) (08/31/88)
[munch, munch away...]
Hi!
I need help with a prototyping-problem:
A FileRequester() of mine uses the address of a filter-function.
The parameter is declared as
FileRequester(...., filter, ...)
....
LONG (*filter)();
...
which is A OK. But. When I try to prototype this with
GLOBAL LONG FileRequester(..., LONG*(), ...);
and simmilar things I get something TYPES DON'T MATCH something.
So, what am I doing wrong? ? ?
Hints, help and comments will be appreciated by
Kristian Wedberg
PS
What I'm using? Amiga Lattice C v4.01! (Am I one patch behind?)pdc@otter.hple.hp.com (Damian Cugley) (09/02/88)
Kristian Wedberg: d85_kitte@tekn01.chalmers.se > [...] I get something TYPES DON'T MATCH something. LONG (*filter)(); `pointer to func giving LONG' || \||/ Delete the identifier ... \/ LONG (* )() || \||/ ... and neaten it up \/ LONG (*)() giving - GLOBAL LONG FileRequester(..., LONG(*)(), ...); (`LONG*()' would be the type of foo in: LONG *(foo()) `func giving pointer to LONG') pdc -- /-------------------\/-------------------------\/------------------------\ | Damian Cugley =@= || pdc@hplb.lb.hp.co.uk || ...!mcvax!ukc!hplb!pdc | | HPLabs Bristol UK || pdc%otter@hplabs.HP.COM || ...!hplabs!otter!pdc | \-------------------/\-------------------------/\------------------------/ (#disclaim <net/std.h> 'His feet are the wrong size for his shoes.')
scjones@sdrc.UUCP (Larry Jones) (09/02/88)
In article <154@tekn01.chalmers.se>, d85_kitte@tekn01.chalmers.se (Kristian Wedberg) writes: > I need help with a prototyping-problem: > > A FileRequester() of mine uses the address of a filter-function. > The parameter is declared as > > FileRequester(...., filter, ...) > .... > LONG (*filter)(); > ... > > which is A OK. But. When I try to prototype this with > > GLOBAL LONG FileRequester(..., LONG*(), ...); > > and simmilar things I get something TYPES DON'T MATCH something. > > So, what am I doing wrong? ? ? The handy rule of thumb for writing types is: write a declaraction then erase the name of the thing being declared (and the semicolon). Thus LONG (*filter)(); becomes LONG (*)() and that's what you need in your prototype. ---- Larry Jones UUCP: uunet!sdrc!scjones SDRC scjones@sdrc.uucp 2000 Eastman Dr. BIX: ltl Milford, OH 45150 AT&T: (513) 576-2070 "Save the Quayles" - Mark Russell