Suppose the “empty” macro definition
#define FOO
Is it valid Standard C? If so, what is FOO after this definition?
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.
It is simply a macro that expands to, well, nothing. However, now that the macro has been defined you can check with
#if defined(or#ifdef) whether it has been defined.will expand to
There are certain situations where this comes in very handy, for example additional debug information, which you don’t want to show in your release version:
Since the macro
CONFIG_USE_DEBUG_MESSAGEShas been defined,DEBUG_MSG(x)will expand toprint(x)and you will getEntering main. If you remove the#define,DEBUG_MSG(x)expands to an emptydo–whileloop and you won’t see the message.