Colourful comments

This is a discussion on Colourful comments within the A Brief History of Cprogramming.com forums, part of the Community Boards category; Does anyone else leave "colourful" comments for themselves / other people? Here's a few of mine I found while digging ...

  1. #1
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709

    Colourful comments

    Does anyone else leave "colourful" comments for themselves / other people?

    Here's a few of mine I found while digging around earlier:

    Code:
    // Nice juicy constructor :-)
    
    // TODO: Build in .tga support. IMG_Load_RW can't handle .tga's from an SDL_RWop stream so got to use IMG_LoadTyped_RW
    // TODO: (continued) see the SDL_image doc's on why I couldn't be arsed to do this from the start
    
    /* StripExtensionFromName
     * Not so much a strip as a "copy but leave out the extension" :-)
     * Returns the new name or 0 on failure.
     */
    Has anyone posted a thread like this before? Wouldn't want to look like an idiot.
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  2. #2
    Registered User axon's Avatar
    Join Date
    Feb 2003
    Posts
    2,572
    Quote Originally Posted by ahluka
    Has anyone posted a thread like this before? Wouldn't want to look like an idiot.
    ....sorry, but you just can't help it. Fatty.

    some entropy with that sink? entropysink.com

    there are two cardinal sins from which all others spring: Impatience and Laziness. - franz kafka

  3. #3
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    No, I usually don't comment my code at all. That's one advantage of programming as a hobby--I'm free to ignore good practices and screw myself over later.
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  4. #4
    Anti-Poster
    Join Date
    Feb 2002
    Posts
    1,399
    Quote Originally Posted by JaWiB
    I'm free to ignore good practices and screw myself over later.
    I'd laugh if it wasn't so true.
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

  5. #5
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    No, I usually don't comment my code at all. That's one advantage of programming as a hobby--I'm free to ignore good practices and screw myself over later.
    ROFLMAO.

    Yeah before I use the code for any type of job interview I probably want to go back and comment some large uncommented sections.

  6. #6
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,069
    I don't comment much either. Though, I haven't worked with other programmers nor have I written anything so large that I need to explain what's going on. Comments seem to pull me out of my rhythm when I'm programming. I lose focus when I comment because I have trouble explaining things that appear obvious to me at the time.

    More often then not, the only kind of comments my program contains is a block comment found at the top, which describes the program usage and any functions. This is done before I write any code or at the very end.
    Sent from my iPad®

  7. #7
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    I've gotten into the habit of commenting every function, even if it's just

    Code:
    /* FunctionName
     * Returns: value(s)
     */
    When I'm skimming through it makes the start of functions stand out. I'm one of those people who try to stick to good practices as much as possible even if I don't actually need to.
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  8. #8
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    One of my favorite activities is to miscomment my code. That way if anyone steals it they'll get confused :P

    When I write code for SMF I will add any new functions to the comment section at the top of the file, that contains the description of the function and its parameters. Inside of function I put comments when I feel they are needed to explain what is going on. Most of the time its just a one liner. Short comments plus the use of empty lines can help more then huge amounts of comments.

  9. #9
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,069
    Too many comments is not good practice at all. It can make code horrible to read. I believe if your comment line to code line ratio is more than 1:1 you're putting way too many comments. I'd rather opt for good identifiers for my variables and functions than bad ones with excess comments.
    Last edited by SlyMaelstrom; 06-11-2006 at 02:39 PM.
    Sent from my iPad®

  10. #10
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  11. #11
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,856
    Get yourself one of these if having trouble with comments.

    http://www.cenqua.com/commentator/
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  12. #12
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,139
    "Don't be too proud of that technological terror you've constructed"

    First comment line on our in house C++ utilities files. Bonus points for instantly recognizing the quote. Use the source, Luke.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  13. #13
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    Darth Vader to one of his commanding officers during a meeting aboard a Super Star Destroyer. His officer was placing too much confidence in the Death Star and underestimating the force. I do think he payed for this comment with his life.


  14. #14
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,488
    I don't comment algorithms I'm not proud, like code hacks, mended stuff, and the product of those "Sue me!" days. In an effort to try and look smart I may comment a "Who did this?" or "Temporary solution while I move to more important parts of the code". But that's it. I don't try to explain what is happening inside.

    I don't need the aggravation of explaining idiocy step by step.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  15. #15
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    Ok well I was close.

    We are thinking of the same scene, I just described it incorrectly.

    Besides I like the schwartz better than the force. Long live Spaceballs.

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. removing comments of type '//' and '/*'
    By rohit83.ken in forum C++ Programming
    Replies: 3
    Last Post: 10-20-2007, 02:24 AM
  2. Comments problem with MSVC 2003
    By mikahell in forum Tech Board
    Replies: 7
    Last Post: 09-04-2006, 06:04 PM
  3. GCC not able to distinguish comments inside string
    By Yasir_Malik in forum C Programming
    Replies: 11
    Last Post: 06-23-2005, 12:11 PM
  4. The Art of Writing Comments :: Software Engineering
    By kuphryn in forum C++ Programming
    Replies: 15
    Last Post: 11-23-2002, 04:18 PM
  5. ignoring comments
    By wjday in forum C Programming
    Replies: 11
    Last Post: 04-24-2002, 11:16 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21