Macros : error: pasting does not give a valid preprocessing token

Discussion in 'C Programming' started by girishk.k4, Mar 23, 2013.

  1. girishk.k4

    girishk.k4

    Joined:
    Mar 23, 2013
    Messages:
    1
    Can someone tell me what is wrong here ?

    #define LOG_MACRO(format,args...) printf(format,args)

    #define TEST_MACRO(__arg1, __arg2, __format, args...) LOG_MACRO("ARG1: %s, ARG2 : %s" ## __format, ##args)

    char* arg1 = "test";
    char* arg2 = "test";
    TEST_MACRO(arg1,arg2,"Testing Macro %s","foo");


    error: pasting ""ARG1: %s, ARG2 : %s"" and ""Testing Macro %s"" does not give a valid preprocessing token
     
    girishk.k4, Mar 23, 2013
    #1
    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. Cronus
    Replies:
    1
    Views:
    676
    Paul Mensonides
    Jul 15, 2004
  2. Frodo Baggins

    "does not give a valid preprocessing token"... Why?

    Frodo Baggins, Sep 15, 2004, in forum: C Programming
    Replies:
    3
    Views:
    1,876
    Frodo Baggins
    Sep 16, 2004
  3. Chris

    macros: not a valid preprocessing token

    Chris, May 10, 2005, in forum: C Programming
    Replies:
    5
    Views:
    1,826
    Chris Torek
    May 11, 2005
  4. Wessi
    Replies:
    3
    Views:
    861
    Lawrence Kirby
    Aug 11, 2005
  5. Ben Bacarisse

    Re: String literals in macros that use token pasting

    Ben Bacarisse, Aug 3, 2009, in forum: C Programming
    Replies:
    2
    Views:
    1,291
    Anand Hariharan
    Aug 4, 2009
Loading...

Share This Page