c - 宏等价物(C/C++)?

标签 c macros c-preprocessor

给定这个宏:

#define SOME_MACRO(ret, f, args) \
    typedef ret (*some_func_##f) args; \
    static some_func_##f my_func_##f = NULL;

请让我知道等同于:

SOME_MACRO(void,  myFunctionName, (int a));

谢谢。

最佳答案

您可以使用gcc 的-E 标志来查看宏是如何展开的:

typedef void (*some_func_myFunctionName) (int a); static some_func_myFunctionName my_func_myFunctionName = ((void *)0);;

关于c - 宏等价物(C/C++)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12039900/

相关文章:

macros - Clojure 宏总是泄漏吗?

debugging - 如何在 Rust 中打印表达式及其值?

macros - Elixir 宏扩展问题,但仅在一个理解中

c++ - 我可以在预处理器和编译器之间压缩我自己的程序吗?

用于捕获空取消引用的 C 预处理器宏

c - 我想添加一组新属性,但我不知道如何添加

c - "A conforming compiler may choose not to implement non-normalized floating point numbers"的意义是什么?

C 错误 : missing whitespace after the macro name

C- SIGUSR1 在语法上到底是什么

c - 为什么 (true && true) 会引发错误,而 (1 && 1) 不会?