相关疑难解决方法(0)

多行预处理器宏

如何制作多行预处理器宏?我知道怎么做一行:

#define sqr(X) (X*X)
Run Code Online (Sandbox Code Playgroud)

但我需要这样的东西:

#define someMacro(X)
    class X : public otherClass
    {
         int foo;
         void doFoo();
    };
Run Code Online (Sandbox Code Playgroud)

我怎样才能让它发挥作用?

这只是一个例子,真正的宏可能很长.

c c++ c-preprocessor

69
推荐指数
5
解决办法
6万
查看次数

标签 统计

c ×1

c++ ×1

c-preprocessor ×1