PDA

View Full Version : Colourful comments



cboard_member
06-11-2006, 08:32 AM
Does anyone else leave "colourful" comments for themselves / other people?

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



// 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.

axon
06-11-2006, 08:43 AM
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.

JaWiB
06-11-2006, 12:53 PM
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.

pianorain
06-11-2006, 01:17 PM
I'm free to ignore good practices and screw myself over later.I'd laugh if it wasn't so true. :(

VirtualAce
06-11-2006, 01:29 PM
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. :D

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

SlyMaelstrom
06-11-2006, 01:44 PM
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.

cboard_member
06-11-2006, 02:22 PM
I've gotten into the habit of commenting every function, even if it's just



/* 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.

Thantos
06-11-2006, 02:22 PM
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.

SlyMaelstrom
06-11-2006, 02:33 PM
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.

JaWiB
06-11-2006, 02:35 PM
For your enjoyment: http://thedailywtf.com/forums/thread/58260.aspx

novacain
06-11-2006, 10:09 PM
Get yourself one of these if having trouble with comments.

http://www.cenqua.com/commentator/

nvoigt
06-12-2006, 01:00 AM
"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.

VirtualAce
06-12-2006, 04:45 AM
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.

:)

Mario F.
06-12-2006, 05:33 AM
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.

VirtualAce
06-12-2006, 05:37 AM
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.

cboard_member
06-12-2006, 05:50 AM
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.

"I'm a Mog, half Man, half Dog. I'm my own best friend."

I've still got that on VHS somewhere.

Heh, combing the desert.

Decrypt
06-12-2006, 10:35 AM
Heh, combing the desert.With an afro pick!


"Man, we ain't found ........!"