Self referencing function prototype typedef

Discussion in 'C Programming' started by Fatz, Jul 18, 2007.

  1. Fatz

    Fatz Guest

    Hello,

    Couldn't find reference to this - apologies if that's cuz attempting
    it is the mark of an ignominous numpty.

    typedef int (FN_t)(char *, FN_t **);

    I'm on VMS doing this, tho that shouldn't matter I spose. Here's the
    error I get:

    .............................^
    %CC-E-TYPNOTFOUND, In this declaration, no typedef with the name
    "FN_t" occurs in any accessible scope.
    at line number 1 in file $1$DGA1:[DENNIS.DEV]FNARG.C;1

    I've got a recursive function with a callout function as a parameter,
    depending on the flow, the callout function needs to be changed for
    the inner call. Do I really have to have 2 function pointers as
    arguments to pull this off?

    If I do something like this:

    typedef int (*FN_1t)(char *, void *);
    typedef int (*FN_t)(char *, FN_1t **);

    it'll work I spose but it's kinda ugly.


    Thanks for any help...

    Fatz.
     
    Fatz, Jul 18, 2007
    #1
    1. Advertising

  2. Fatz

    Eric Sosman Guest

    Fatz wrote On 07/18/07 11:21,:
    > Hello,
    >
    > Couldn't find reference to this - apologies if that's cuz attempting
    > it is the mark of an ignominous numpty.
    >
    > typedef int (FN_t)(char *, FN_t **);
    >
    > I'm on VMS doing this, tho that shouldn't matter I spose. Here's the
    > error I get:
    >
    > ............................^
    > %CC-E-TYPNOTFOUND, In this declaration, no typedef with the name
    > "FN_t" occurs in any accessible scope.
    > at line number 1 in file $1$DGA1:[DENNIS.DEV]FNARG.C;1
    >
    > I've got a recursive function with a callout function as a parameter,
    > depending on the flow, the callout function needs to be changed for
    > the inner call. Do I really have to have 2 function pointers as
    > arguments to pull this off?
    >
    > If I do something like this:
    >
    > typedef int (*FN_1t)(char *, void *);
    > typedef int (*FN_t)(char *, FN_1t **);
    >
    > it'll work I spose but it's kinda ugly.


    See Question 1.22 in the comp.lang.c Frequently
    Asked Questions (FAQ) list, <http://www.c-faq.com/>.

    --
     
    Eric Sosman, Jul 18, 2007
    #2
    1. Advertising

  3. Eric Sosman <> wrote:
    > See Question 1.22 in the comp.lang.c Frequently
    > Asked Questions (FAQ) list, <http://www.c-faq.com/>.


    The FAQ doesn't give a reason for omitting the keyword 'void' from the
    empty parameter lists.

    --
    Thomas E. Dickey
    http://invisible-island.net
    ftp://invisible-island.net
     
    Thomas Dickey, Jul 19, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ralf W. Grosse-Kunstleve
    Replies:
    16
    Views:
    595
    Lonnie Princehouse
    Jul 11, 2005
  2. Ralf W. Grosse-Kunstleve
    Replies:
    18
    Views:
    602
    Bengt Richter
    Jul 11, 2005
  3. Ralf W. Grosse-Kunstleve
    Replies:
    2
    Views:
    409
    Dan Sommers
    Jul 12, 2005
  4. falcon
    Replies:
    0
    Views:
    381
    falcon
    Jul 31, 2005
  5. Bart Kastermans
    Replies:
    6
    Views:
    409
    Bart Kastermans
    Jul 13, 2008
Loading...

Share This Page