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

This is a discussion on pasting "X" and "X" does not give a valid preprocessing token within the C Programming forums, part of the General Programming Boards category; Hello, I have to make some code that already exist compile and get the following message pasting "(" and "ICC1" ...

  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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,530
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21