943,910 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 686
  • C++ RSS
Oct 3rd, 2008
0

C++ Comments

Expand Post »
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 =)
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
DanDaMan is offline Offline
13 posts
since Jul 2008
Oct 3rd, 2008
0

Re: C++ Comments

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.
Reputation Points: 161
Solved Threads: 43
Posting Whiz
stilllearning is offline Offline
309 posts
since Oct 2007
Oct 4th, 2008
0

Re: C++ Comments

stilllearning is correct. The compiler is only interested in the statements that do something so comments are not part of the compiled program.
Moderator
Reputation Points: 3278
Solved Threads: 892
Posting Sage
WaltP is online now Online
7,730 posts
since May 2006
Oct 4th, 2008
0

Re: C++ Comments

I see. Thank you very much =)
Reputation Points: 10
Solved Threads: 0
Newbie Poster
DanDaMan is offline Offline
13 posts
since Jul 2008
Oct 4th, 2008
1

Re: C++ Comments

>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.
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004
Oct 4th, 2008
0

Re: C++ Comments

Comments are ignored during the parsing stage. It has totally no effect on the final executable.
Reputation Points: 118
Solved Threads: 15
Posting Pro in Training
Denniz is offline Offline
428 posts
since Sep 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: A problem, I'm stucked in OpenGl
Next Thread in C++ Forum Timeline: C++ RTF Problem





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC