Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

squirrel_of_death

C++ needs the super-comment

This topic is 5282 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

why, oh why, do we not have something like : //* <- this is a super-comment style /* normal c comment */ code /* c comment */ code /* c comment */ code *// so all the above is invisible so we can Super-Comment lots of code? As things stand, then we have to put lots of little annoying comments into code like above, where we just want to hide the whole thing! Just a rant from //* me *//.

Share this post


Link to post
Share on other sites
Advertisement

/*

// normal C++ comment
code
// C++ comment
code
// C++ comment
code

*/



Anyway, what you really want is not "super-comments", but nested comments. Which could be interesting.

Share this post


Link to post
Share on other sites

#if 0
/* normal c comment */
code
/* c comment */
code
/* c comment */
code
#endif


Like that?

Share this post


Link to post
Share on other sites
quote:
Original post by squirrel_of_death
Chozo, thank you! That is awesome. I''m going to use that a lot for development. Only wish I''d thought of it!


Please don''t. It''s ugly as hell and confusing for anyone maintaining the code (#if 0 is easy to miss and the ide won''t provide any syntax colouring for it).

If you want to remove a block of code from execution, delete it! You can always get it back using your version control system (and if you''re not using one now''s the time to start). free source control for windows or for *nix

Share this post


Link to post
Share on other sites
The editor I use (Kate) has two little functions built in that will comment and uncomment highlighted text. If the text has some /*...*/ comments it''ll put // before each line. (It also works with non C++ language comments.) Quite handy.

Share this post


Link to post
Share on other sites
I usually just encase blocks of code in /* */... Or did I miss the point somewhere along the line of this thread?

Share this post


Link to post
Share on other sites
hey ChaosEngine, that''s why I sneaked the word development in there! read : hacking, you know, when you are tearing the code from file to file in huge chuncks. The gestational experimental stuff you dare not let others see. In hope they think of you as some super-coder.

And RuneLancer, yes, the point is, if you import a huge section of code from someone elses code ( or even your own ), and let''s say it''s full of C style comments. Then let''s say you want the whole lot commented out, just so you can compare it directly with your own. Or browse it, whatever. The problem is.. one /* at the top, and */ at the bottom will not work, as all those little c comments cancel you out. And the motivation for this thread was me getting sick of putting all those little comments, when one is all you are looking for. So enter the Super-Comment!! Yay for the SC. Provided by your friendly pre-compiler!!!

Share this post


Link to post
Share on other sites
I''m using MS VC++ 6.0. Looking in my Customize menu->keyboard->macros, I get the CommentOut option. However, that just adds a /* ... */ to whatever you select. Any suggestions?

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!