相关疑难解决方法(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++单行注释后跟多行注释中的\ transforms

它在C++标准中的哪个部分记录了如果使用//some comment\样式注释一行(在行放置的末尾\),注释将转换为多行的功能?

用g ++ 4.8和VS 2012测试

//some interesting stuff\
another interesting stuff\
etc
Run Code Online (Sandbox Code Playgroud)

c c++

45
推荐指数
5
解决办法
3368
查看次数

标签 统计

c ×2

c++ ×2

c-preprocessor ×1