Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!usc!rpi!crdgw1!camelback!volpe From: volpe@camelback.crd.ge.com (Christopher R Volpe) Newsgroups: comp.lang.c Subject: Re: Recursive function pointer type. How? Message-ID: <17538@crdgw1.crd.ge.com> Date: 13 Mar 91 13:37:05 GMT References: <5144@lure.latrobe.edu.au> <17534@crdgw1.crd.ge.com> Sender: news@crdgw1.crd.ge.com Reply-To: volpe@camelback.crd.ge.com (Christopher R Volpe) Lines: 22 In article <17534@crdgw1.crd.ge.com>, I wrote |>In article <5144@lure.latrobe.edu.au>, ECSGRT@lure.latrobe.edu.au |>(GEOFFREY TOBIN, ELECTRONIC ENGINEERING) writes: |>|>One way *around* the problem is to use "typedef void (* state) ();", |> ^^^^ |>If the return value is void, there's nothing there to cast. I think |>you meant: "typedef void *(*state)()". Oops. One other thing I forgot. You wouldn't want to return a "void *" if you're planning on casting that to a function pointer. Pointers to void are not compatible with pointers to functions. You at least need it to return a generic function pointer of some sort. Perhaps something like: "typedef void (*(*state)())()". I.e., state is a pointer to a function that returns a vanilla function pointer. ("Vanilla function pointer" means "pointer to function of unspecified arguments that returns nothing", but this is irrelevant since it will be cast to the proper function pointer type before invoking.) ================== Chris Volpe G.E. Corporate R&D volpecr@crd.ge.com