Eclipse:注释整个代码,而不被另一条注释打断 我说有以下代码(C++中的,但这对问题可能不重要):
在eclipse中,当我想通过在代码前后放置/*和*/注释掉整个代码时,注释会被第3行“thisacomment”末尾的*/截断,因此代码的其余部分没有注释Eclipse:注释整个代码,而不被另一条注释打断 我说有以下代码(C++中的,但这对问题可能不重要):,c++,eclipse,comments,block-comments,C++,Eclipse,Comments,Block Comments,在eclipse中,当我想通过在代码前后放置/*和*/注释掉整个代码时,注释会被第3行“thisacomment”末尾的*/截断,因此代码的其余部分没有注释 /* //<--overall comment starts here int main() { ....random code.... /*This is a comment*/ //<--overall comment ends here ....random code.... r
/* //<--overall comment starts here
int main() {
....random code....
/*This is a comment*/ //<--overall comment ends here
....random code....
return 0;
}
*/ //<--overall comment SHOULD end here
<代码> /*//< p>在C++中没有嵌套注释的方法。一种解决方案(特别是如果您不想将大量
/***/
更改为/
)是使用预处理器,您可以执行以下操作
#ifdef SOME_RANDOM_SYMBOL
code that you want to comment here
#endif
只需确保代码中没有以某种方式定义某个随机符号
正如@Caleb在评论中提到的,您也可以这样做
#if 0
code that you want to comment here
#endif
但是使用符号可以让你搜索它。或者只要#如果0#endif
,但某些随机符号
允许您在要撤消更改时为其提供易于搜索的名称。
#if 0
code that you want to comment here
#endif