Does comments in c++ important? If it is why? The comments are just a extra lines i think please help! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Does comments in c++ important? If it is why? The comments are just a extra lines i think please help!

21st Aug 2017, 3:53 PM
Code Master
Code Master - avatar
3 Answers
+ 8
cooments are useful as my other friends said and There are some minimums: 1.All functions and classes should be commented 2.Try/Catch and exception handling is better to be commented 3.Constants hard coded in the code should be definitely 4.dummy objects and dummy classes, as well as TO-DO parts should be commented 5.When you get a code from a URL, the address should be cited in the comments for further consideration and copyright infringement problems 6.Also commits to the version control system should be well commented
21st Aug 2017, 4:03 PM
P R
P R - avatar
+ 2
Comments become much more important if you plan to share your code, or even if you come back to your own code weeks or months later. They are a way to add explanations for why you are doing things the way you are, and to make the program easier for a human to go through and understand
21st Aug 2017, 3:57 PM
Ralph Landon
Ralph Landon - avatar
+ 1
I haven't done the C++ course, but I believe comments are lines of text that is ignored by the compiler, so you can simply comment about your code. It should be useful, because if you have other people looking at your code, you can describe it to make reading it easier. It's also good to comment on code for when you haven't looked at your own complex code in a long time - Giving yourself some tips and helpful information.
21st Aug 2017, 3:59 PM
Dandyylion
Dandyylion - avatar