为什么VS 2010的“注释"键盘快捷键在C ++中会发生变化? [英] Why Does VS 2010 'Comment' Keyboard Shortcut Change in C++?
问题描述
对我而言,Visual Studio的 Ctrl + K , Ctrl + C 键盘快捷键用于注释-选中的行.编辑C ++时,有时使用块注释(/* */
),有时使用行注释(//
).为什么会改变?如何决定何时使用哪个?
For me, Visual Studio's Ctrl + K, Ctrl + C keyboard shortcut is used to comment-out the selected lines. When editing C++, this sometimes uses block comments (/* */
) and sometimes uses line comments (//
). Why does it change? How does it decide which to use when?
推荐答案
有关该主题的其他一些讨论:
A couple other discussions on the topic:
Visual Studio功能-注释代码Ctrl K-Ctrl C
Visual Studio C ++切换注释?未选择整行时发表评论吗?
根据我自己的修改,以及那些文章中的说法...
Based on my own tinkerings, and what was said in those articles...
它基于选择的开始/结束.每次在行首开始选择并在行尾结束时,似乎都使用双斜杠//
.
It's based on the start/end of the selection. It seems to use double slashes //
whenever you start your selection at the beginning of the line AND end it at the end of a line.
只要选择出现在行的中间,它将使用/* */
表示法.
It will use /* */
notation whenever the selection occurs midway through lines.
IE:
如果我有代码
int main () {
return 0;
}
,仅突出显示int main
,它将转换为/*int main*/
.
and highlight only int main
, it will convert it to /*int main*/
.
如果我突出显示整个代码部分(从缩进标签开始),它将把它转换为
If I highlight the entire code section, starting after the indent tab, it will convert it to
/*int main () {
return 0;
}*/
但是,如果我突出显示缩进选项卡之前的部分,则会将其转换为
But if I highlight the section starting before the indent tab, it converts it to
//int main () {
// return 0;
//}
这篇关于为什么VS 2010的“注释"键盘快捷键在C ++中会发生变化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!