Check whether function is declared with C preprocessor?

后端 未结 5 1437
醉梦人生
醉梦人生 2020-12-20 12:31

Is it possible to tell the C preprocessor to check whether a function (not a macro) is declared? I tried the following, but it doesn\'t appear to work:

5条回答
  •  感情败类
    2020-12-20 12:59

    No. Preprocessor runs before the C compiler and the C compiler processes function declarations. The preprocessor is only there for text processing.

    However, most header files have include guard macros like _STDIO_H_ that you can test for in the preprocessor stage. However, that solution is not portable as the include guard macro names are not standardized.

提交回复
热议问题