C++ Comments

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Jul 2008
Posts: 13
Reputation: DanDaMan is an unknown quantity at this point 
Solved Threads: 0
DanDaMan DanDaMan is offline Offline
Newbie Poster

C++ Comments

 
0
  #1
Oct 3rd, 2008
Now, we all know that // makes a comment. But I have a question about the compiling of the program? Say you were to make a comment with a whole bunch of underscores to signify a different section of code. Does the amount of comments written in the source code increase the size of the final executed file or make the program any slower, even by a microsecond? Or does C++ just skip right over the comments or automatically delete them while compiling? Thanks in advance =)
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 305
Reputation: stilllearning has a spectacular aura about stilllearning has a spectacular aura about 
Solved Threads: 43
stilllearning stilllearning is offline Offline
Posting Whiz

Re: C++ Comments

 
0
  #2
Oct 3rd, 2008
As far as I know, the compiler should just ignore the comments while parsing your code. So it should not have any effect on executable size or speed.
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 3,114
Reputation: WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of 
Solved Threads: 281
Moderator
WaltP's Avatar
WaltP WaltP is offline Offline
Posting Sensei

Re: C++ Comments

 
0
  #3
Oct 4th, 2008
stilllearning is correct. The compiler is only interested in the statements that do something so comments are not part of the compiled program.
The 3 Laws of the Procrastination Society:
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 13
Reputation: DanDaMan is an unknown quantity at this point 
Solved Threads: 0
DanDaMan DanDaMan is offline Offline
Newbie Poster

Re: C++ Comments

 
0
  #4
Oct 4th, 2008
I see. Thank you very much =)
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,740
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 739
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: C++ Comments

 
1
  #5
Oct 4th, 2008
>Does the amount of comments written in the source code increase the size of the
>final executed file or make the program any slower, even by a microsecond?
No, comments are stripped from the source during compilation.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 429
Reputation: Denniz is on a distinguished road 
Solved Threads: 15
Denniz's Avatar
Denniz Denniz is offline Offline
Posting Pro in Training

Re: C++ Comments

 
0
  #6
Oct 4th, 2008
Comments are ignored during the parsing stage. It has totally no effect on the final executable.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC