I was trying to know how // and " can be passed into a macro substitution as like below:
#define STR(str) #str
while invoking STR(hel"lo) or STR(hel//lo).
This gives error. Is there any way to pass these into a macro?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is no way to pass
//into a macro invocation except embedded in a string or character constant as the//marks the start of a comment-to-end-of-line. Comment stripping is done before macros are processed.Similarly, there is no way to pass a naked double quote to a macro. The double quote is either inside a character constant or marks the start of a string.
Similarly for
/*and', with appropriate changes to the reasoning.