Are there any restrictions to the C standard allowing functions to be implemented as macros?
- 阅读更多 关于 Are there any restrictions to the C standard allowing functions to be implemented as macros?
问题 Often, in addition to providing a function declaration, C standard headers may provide a "masking macro" to make things speedier. For example, if I include ctype.h , the header file will declare int isdigit(int c); But it may also mask the declaration with a macro. I believe this is a portable isdigit macro according to the C standard: #define isdigit(c) ((c) >= '0' && (c) <= '9') Of course, this macro is also dangerous because it introduces undefined behavior if you do this while the macro