Commenting code in C ++, visual studio

I am testing the C ++ source code and want to comment on a part of the code. Visual Studio has a shortcut: Ctrl + K and Ctrl + C for comments and Ctrl + K and Ctrl + U for terminating the code. I can successfully comment on the code, but uncommenting it will not be a "cancellation". It always removes some characters from existing comment lines. Here is an example:

/*function 1 */ int func1() { return 0; } 

If I want to comment on this code, I can apply Ctrl + K and Ctrl + C after selecting the code. And it will be something like this:

 ///*function 1 */ //int func1() //{ // return 0; //} 

If I want to cancel the comment, I have to apply Ctrl + K and Ctrl + U after selecting everything. It will be:

 *function 1 */ int func1() { return 0; } 

It removes the extra '/' and the old comment becomes damaged. Is this normal behavior or am I doing something wrong?

+4
source share
1 answer

Why not use

 #if 0 {code here, lots of it even nested /* */ } #endif 
+4
source

All Articles