I have the source code of an application written in C++ and I just want to comment something using:
#ifdef 0 ... #endif
And I get this error
error: macro names must be identifiers
Why is this happening?
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.
The #ifdef directive is used to check if a preprocessor symbol is defined. The standard (
C11 6.4.2 Identifiers) mandates that identifiers must not start with a digit:The correct form for using the pre-processor to block out code is:
You can also use:
but you need to be confident that the symbols will not be inadvertently set by code other than your own. In other words, don’t use something like
NOTUSEDorDONOTCOMPILEwhich others may also use. To be safe, the#ifoption should be preferred.