Thread: pasting "X" and "X" does not give a valid preprocessing token

  1. #1
    Registered User
    Join Date
    Jun 2007
    Posts
    7

    pasting "X" and "X" does not give a valid preprocessing token

    Hello,

    I have to make some code that already exist compile and get the following message

    pasting "(" and "ICC1" does not give a valid preprocessing token.

    The macro is the following
    Code:
    #define  BIN_RAD(x)      (1 << (## x))
    and the macro call is
    Code:
    *crew_info[CRW1+crw_index].crwctx = BIN_RAD(RAD11+icc_index)
    icc_index is an integer and RAD11 is #define RAD11 10 and crwctx is a long

    Help Needed Please
    Ben
    Last edited by benny5788; 06-29-2007 at 07:27 AM.

  2. #2
    Registered User
    Join Date
    Jun 2007
    Posts
    7
    Sorry, posted the wrong error message. I have same error at multiple places
    It's
    pasting "(" and "RAD11" does not give a valid preprocessing token

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Do you know what ## is for?
    What exactly are you hoping to get out of the BIN_RAD macro?

    Example

    #define CAT(x,y) x ## y
    int CAT(abc,123) = 42;


    Is the same as
    int abc123 = 42;
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed