In the C/C++ there are 2 types of macro:
#define ABC /* usual */
und
#define FUNC(a) /*function-like*/
But how can I undefine them?
Update: So there is no difference between undefing “constant-like macro” and “function-like 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.
#undef“cancels” out a previous#define. The effect is as though you never had a previous#definefor a particular identifier. Do note that#defines do not respect scope, so it’s best to use them only when you need to.Also note that it doesn’t matter if one macro identifier uses the “usual” syntax while another uses a “function-like” syntax.
#define ABCand#define ABC(A)both define a macro namedABC. If you have both, without#undefing one of them, the latest one “overrides” the other. (Some compilers may emit a warning if this happens.)