I need to have multi-line comments within a group of macros so that one of the macros initiates a comment block and another concludes it, like this:
#define C_BEGIN /*
#define C_END */
... other macros
But sure enough, this approach doesn’t work.
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.
You can’t do it for the following reasoning. Let’s assume it is possible.
So you created a macro that replaces itself with
/*, and another for*/. What happens then? First, the comments are removed from the code. After that, the preprocessor replaces your macros with the comments. After that, the compiler will choke: it doesn’t know what to do with/*and*/because it simply never faces such things: the comments are always delete before the compilation, so it doesn’t even know what a “comment” is. It will probably think it’s a division followed by multiplication.So our assumption is wrong and you can’t do it.