Shortcut for Commenting out a large block of code
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Shortcut for Commenting out a large block of code

  1. #1
    Join Date
    Feb 2013
    Posts
    36

    Shortcut for Commenting out a large block of code

    Is there a quick shortcut (like CTRL+something) to comment out/ decomment a large block of code in Dev C++ when it is selected?

    I find it tedious to go line by line and add the // in front of each line.

  2. #2
    Join Date
    Dec 2012
    Location
    England
    Posts
    2,361

    Re: Shortcut for Commenting out a large block of code

    Yeah - use the /*...*/ way of commenting. Everything between /* and */ is commented out. Note that this way of commenting is not recursive so /*../*..*/..*/ cannot be used - but it can include //comments

    /*These are various lines of code
    I want to comment out
    It is tedious to keep using //
    so I use the other way instead*/

  3. #3
    Join Date
    Feb 2013
    Posts
    36

    Re: Shortcut for Commenting out a large block of code

    Thanks!

  4. #4
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,634

    Re: Shortcut for Commenting out a large block of code

    Change to a newer environment. Dev C++ hasn't been maintained for a long time. In the free MSVC Express for instance you just mark the area and press Ctrl+K,C to comment and Ctrl+K,U to uncomment. I bet other modern environments has something similar.
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    http://www.microsoft.com/visualstudio/eng/downloads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center