• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 252
  • Last Modified:

Comments/Remarks and Program Compiling

Simple question (I would believe!):

Anything in a VB program that has an apostrophe in front of it is "greened out" as a remark or comment. Now, does that remark/comment compile into the final product? If it does, is there a way to prevent that from occuring without removing them all manually?

Thanks for the answer! Any evidence would be appreciated.
1 Solution
They shouldnt be compiled. It would be pretty silly to add stuff into the compiled program that wont be read by any person or even by the computer, it would take up Unnesessary space.

No. you can test this out by opening a blank project and then boudle click on the form to open the code window. Under the Form_Load event type the following

'' This is evidence that comments do not get compiled into the executable.
'' So even though you comment your code no one other than those with your
'' source can read them.
'' Also variable names are not saved. IE If you have Dim Counter as long
'' some one trying to reverse compile your program will not be able to see
'' the Word Counter. VB replaces it with a generic name

Compile the program. you can then open the program in notepad and see the comments are not compiled.
Just to make it unanimous, COMMENTS (' This would be a comment) are NOT compiled into the EXE

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

doinVBstuffAuthor Commented:
Ok, so that I get this straight, they are not compiled into the program. So, it begs to ask the question, are they actually removed or just hidden? The reason I ask is because I noticed that with one of my larger programs, if I remove the comments, it seems to make the compiled program smaller in actual size. Is this just coincidental or something more?

Thanks for all the answers so far.
Just coincidental. You may have removed more than just comments. maybe a component reference or a variable declaration that was not used. The variable names and comments are not compiled into the program on VB6. Are you using VB6 or something else?
comments are totally ignored by the compiler, so when the exe is created the compiler hasnt readthe comments to put them into the exe.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now