我有一个以反斜杠结尾的注释。类似于:
...
// use \
..
Clang(++)警告我,这是多行注释。
warning: multi-line // comment [-Wcomment]
// use \
^
我尝试在末尾添加一些空格,但没有帮助。我能否以某种方式转义反斜杠?
我有一个以反斜杠结尾的注释。类似于:
...
// use \
..
Clang(++)警告我,这是多行注释。
warning: multi-line // comment [-Wcomment]
// use \
^
我尝试在末尾添加一些空格,但没有帮助。我能否以某种方式转义反斜杠?
#define ME {\
cout << "me\n" \
}
#define ME {cout << "me\n"}
'\'
\ ending character
// use \ (backslash) instead of the normal slash here, because ...
#include<iostream>
using namespace std;
int main()
{
// print `\`
cout << "DONE" << endl;
return 0;
}
也许你有这样的代码:
#define foo {int x = 123; \
cout << x << endl; \
}
如果你想将它注释掉:
//#define foo {int x = 123; \
//cout << x << endl; \
//}
上述代码应该可以正常工作。另一方面,如果你写成:
#define foo {int x = 123; \
cout << x << endl; \
} \
如果下一行为空,则foo可能有效,但是如果您将其注释掉,则会遇到麻烦。只需删除最后一个反斜杠即可。否则,除非它的目的是连接,否则不要以反斜杠结尾...