Thread: preprocessor

  1. #1
    Registered User
    Join Date
    Nov 2012


    Why does the following line of code generate error as " pasting / and / doesnot generate a valid preprocessing token"? Can someone please help

    #define comment /##/
       int main()
        comment printf("hello");
        return 0;

  2. #2
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    United States
    ## is an operator for the preprocessor. It glues tokens together. See C preprocessor - Wikipedia, the free encyclopedia

    Also, by the time preprocessing happens, comments are removed.

  3. #3
    young grasshopper jwroblewski44's Avatar
    Join Date
    May 2012
    Where the sidewalk ends
    They are not valid tokens.

    Token-Pasting Operator (##) (C/C++)

    Also as whiteflags says, comments are removed during pre-processing ( [search for "comment removal" or "Preprocessing"]). So that really doesn't make sense.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. preprocessor
    By pin2 in forum C Programming
    Replies: 5
    Last Post: 12-24-2009, 12:55 AM
  2. Preprocessor help
    By royen in forum C++ Programming
    Replies: 3
    Last Post: 05-14-2009, 10:56 AM
  3. preprocessor help
    By brunogon in forum C Programming
    Replies: 13
    Last Post: 06-16-2008, 11:14 AM
  4. Preprocessor
    By manutd in forum C++ Programming
    Replies: 5
    Last Post: 11-29-2006, 04:37 PM
  5. C preprocessor
    By Unregisterd in forum C Programming
    Replies: 1
    Last Post: 09-04-2001, 12:17 PM

Tags for this Thread