I'm replacing one C-style macro with another.
#define OldMacro(…) {…}
#define NewMacro(…) {…}
I'd like to rewrite the old version of the macro so that it fails to compile with a specific error message, ie something like: "OldMacro() is deprecated; use NewMacro() instead." Is this possible?
Also, I'd like this to work in C, C++ and Objective-C.
您可以使用此宏定义:
#define OLD_MACRO() (error_use_of_OLD_MACRO_is_deprecated = 0)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.