-2

I will release a program (not Alpha/Beta/Testing versions). Should I remove the comments in the code?

I have some comments that I added to make the code less confusing to me, but since the program will be compiled, and no one should be able to see my code unless they de-compile my program.

Should I remove or leave those comments?

  • 1
    As a tangent, "Is it ideal to put comments in code?" As you say, "[you] have some comments that [you] added to make the code less confusing to [you]". Comments should never be used to explain bad code. Take those comments out and fix the code to make it easier to understand. – David Arno Aug 10 '17 at 7:01
  • @DavidArno To be honest, that 'code' isn't really very very confusing, but I just want it to act as a remark so I understand what's going on, maybe 20 years later. – stevefestl Aug 10 '17 at 7:02
9

Of course you should not remove comments, you may need to sanitise some of them in some cases, e.g. "Correction Factor" rather than "Fiddle Factor don't know why this works?" if your customer/client may be seeing the source code.

Most compilation tools completely remove, by ignoring, any comments so decompilation does not give the comments.

Comments in your source code should only be removed if they are no longer true, e.g. TODO:.... comments when you have done what they are talking about.

4

Should I remove the comments in the code?

No.

I have some comments that I added to make the code less confusing to me, but since the program will be compiled ...

Comments are of no practical value to a compiled program, which is why the compiler will simply discard all your comments as it goes along.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.