home *** CD-ROM | disk | FTP | other *** search
- From: curry@hplred.HPL.HP.COM (Bo Curry)
- Date: Tue, 15 Dec 1992 02:21:58 GMT
- Subject: Pointer to Function Question
- Message-ID: <1000001@hplred.HPL.HP.COM>
- Organization: Hewlett-Packard Laboratories, Palo Alto, CA
- Path: sparky!uunet!usc!sdd.hp.com!apollo.hp.com!cupnews0.cup.hp.com!hpscit.sc.hp.com!hplextra!hplred!curry
- Newsgroups: comp.lang.c
- Lines: 29
-
- I have a pointer-to-function question which is baffling me. Perhaps one
- of the gurus out there has the answer?
-
- typedef struct {
- void (* displayit)(struct _WINDOW *);
- } DISPLAYTYPE;
-
- static void ShowMyPanes(struct _WINDOW *);
-
- int Testit ()
- {
- DISPLAYTYPE mypanes;
-
- mypanes.displayit= ShowMyPanes;
-
- ...
- }
-
- My compilers, both the HPUX ANSI c89 (8.54) and Microsoft 7.0, complain that
- the "Pointers are not assignment-compatible". The code seems correct, and
- works OK. If the argument of the assigned function is int, or (void *),
- they don't complain, only if it is (struct x *).
-
- Any advice, explanations, or gentle instruction would be appreciated.
-
- Thanks,
-
- Bo Curry
- curry@hplabs.hpl.hp.com
-