Question about the "//" comments' seen in C++

Hello there. I am currently designing code for an Xbox 360 Game. The code runs on C++, and I have a question. While I read through the templates for my game, I see on every line a comment:

//comment here

These comments usually give advice to the editor (me) while editing and reviewing code. So for example, I see this:

//if there is nobody chosen for some reason, then just force him on a player

But what comes to my mind, is this:

//tag_origin thread draw_tag_angles( "origin_animate_jnt" );

So I ask. Is it safe to remove these types of things, or is it needed for debug. I do see the "//''s, but I also see code behind it. Any ideas. Thanks.
That's called "commenting out". You turn code you temporarily want to disable or code that you might need at a later date for debugging into comments. Since comments don't affect the behavior of the program, you can safely remove them if you want.
When people comment out code, it's usually because it's incomplete, buggy, an optional/experimental feature, or the code is for debugging only (like assert()).

Edit: You win this time, Athar!
Last edited on
It is a common habit among professionals to use #if 0 ...#endif to comment out incomplete/buggy/optional/experimental stuff. Using #if 0 is an immediately recognizable signal to others that it is the case.

See also:
https://developer.mozilla.org/en/C___Portability_Guide#Use_.23if_0_rather_than_comments_to_temporarily_kill_blocks_of_code
http://technopark02.blogspot.com/2005/06/cc-conditional-compilation-and-if-0.html
http://www.cprogramming.com/tutorial/cpreprocessor.html

Hope this helps.
Topic archived. No new replies allowed.