help me to understand the declaration as well as the reason

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • srikar
    New Member
    • Sep 2006
    • 62

    help me to understand the declaration as well as the reason

    Hi I am having a problem using typedef

    what does these declaration mean?

    typedef gtb(string_t, tt_type_enum) tt_type_table( &stringless, &stringequal s );
    typedef gtb(string_t,tt _qual_enum) tt_qual_table( &stringless, &stringequal s);

    where gtb is a macro
    #define gtb(key_type,va lue_type) name3(value_typ e,tb,key_type)
    #define name3(a,b,c) _name3_aux(a,b, c)
    #define _name3_aux(a,b, c) a##b##c
    '#" is for concatenation

    string_t is pointer to class string_rec
    tt_type_enum is of type enum

    stringless is (int stringless(tb__ item_t a, tb__item_t b))
    stringeuals is (int stringequals(tb __item_t a, tb__item_t b))

    when i am using the first declarations in my code I am getting error
    syntax error before `(' token, for both typedefs.

    help me to understand the declaration as well as the reason

    for the syntax error..

    regards

    srikar
  • srikar
    New Member
    • Sep 2006
    • 62

    #2
    any one suggest me

    Comment

    • Banfa
      Recognized Expert Expert
      • Feb 2006
      • 9067

      #3
      It is very confusing

      typedef gtb(string_t, tt_type_enum) tt_type_table( &stringless, &stringequal s );

      when we apply the gtb macro ends up as

      typedef tt_type_enumtbs tring_t tt_type_table( &stringless, &stringequal s );

      I think the & are wrong but may be the compiler does care.

      Looks like it is may be trying to declare a type that is a pointer to a function that returns tt_type_enumtbs tring_t and takes 2 other pointers to functions as parameters.

      Comment

      Working...