I am testing a C++ source and I want to comment out some part of the code. There is a shortcut in Visual Studio: Ctrl+K and Ctrl+C for commenting and Ctrl+K and Ctrl+U for uncommenting the code. I can successfully comment out the code but uncommenting it will not be an "undo". It always removes some characters from the existed comment lines. Here is an example:
/*function 1 */
int func1()
{
return 0;
}
If I want to comment out this code, I can apply Ctrl+K and Ctrl+C after selecting the code. And it becomes like this:
///*function 1 */
//int func1()
//{
// return 0;
//}
If I want to un-comment the code, I should apply Ctrl+K and Ctrl+U after selecting it all. It becomes:
*function 1 */
int func1()
{
return 0;
}
It removes an additional '/'
and the old comment becomes corrupted. Is this a normal behavior or am I doing something wrong?
Why not use
#if 0
{code here, lots of it even nested /* */ }
#endif
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With