Thread: the definitive guide to code commenting

  1. #1
    Registered User Aran's Avatar
    Join Date
    Aug 2001
    Posts
    1,301

    the definitive guide to code commenting

    here's an idea:
    the more experienced people here use this thread to compare ideas on when and how to comment and share their own styles of commenting and code organization.

    i'll post mine after i get some responses...

  2. #2
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    Always use // instead of /**/.

    When commenting out large areas of the code, perhaps when testing, the comments won't show up when viewed in a texteditor without syntax highlightning. (or for example this forum)

    VC++ can comment and uncomment a selected area automatically.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  3. #3
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    Originally posted by Sang-drax
    VC++ can comment and uncomment a selected area automatically.
    gimme a keystroke for that. Didn't know that existed.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  4. #4
    Seeking motivation... endo's Avatar
    Join Date
    May 2002
    Posts
    537
    Excessive commenting is worse than too little imo.
    Couldn't think of anything interesting, cool or funny - sorry.

  5. #5
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    In VC++.NET:

    Ctrl+K, Ctrl+C
    Ctrl+K, Ctrl+U

    or

    Edit->Advanced->(Un)Comment Selection
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  6. #6
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    oh, you meant VC++ .NET.

    no wonder I've never seen it.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Proposal: Code colouring
    By Perspective in forum A Brief History of Cprogramming.com
    Replies: 28
    Last Post: 05-14-2007, 07:23 AM
  2. Values changing without reason?
    By subtled in forum C Programming
    Replies: 2
    Last Post: 04-19-2007, 10:20 AM
  3. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 04:17 PM
  4. Updated sound engine code
    By VirtualAce in forum Game Programming
    Replies: 8
    Last Post: 11-18-2004, 12:38 PM
  5. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM