代码不应该:
int Func(int a, // comment
int b, // comment
int c // comment
) ...
相当于:
int Func(int a, // comment int b, // comment int c // comment) ...
为什么它可以正确构建(至少使用 G++)?
到目前为止,我总是在这种情况下使用 /* */
注释。
最佳答案
int Func(int a, // comment
int b, // comment
int c // comment
) ...
转换为
int Func(int a,
int b,
int c
) ...
在 third phase of translation 期间.如果你想在翻译阶段发生之前有一行等价的,那么你需要使用 /* */
like
int Func(int a /*comment 1*/, int b /*comment 2*/, int c /*comment 3*/ ) ...
关于C++,在多行代码中注释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51896653/