views:

454

answers:

8

I'm talking about special words/tokens used in the beginning of comments, to facilitate grepping or otherwise to attach some special meaning to the comment, like // TODO: Find out what to do about this error.

The meaning of some tags are obvious, like TODO and FIXME, but what about ??? and !!!? Are there others? I'm asking because I've seen the last two quite a lot recently and some editors, i.e. Xcode, provide a simple way to find all comments which such tags.

If there's no standard as such, I'm fine with a description of whatever company-local policy you might have. :)

Edit: Bonus points for referencing an actual document.

+6  A: 

In Visual Studio, there's a "Task List", and the default tags (on VS2010) are "HACK", "TODO", "UNDONE" and "UnresolvedMergeConflict". So I would recommend using these if you are using Visual Studio.

GameZelda
With HACK meaning something like FIXME and UNDONE meaning ... what exactly?
calmh
Actually with Visual Studio you can define your own. Which can be all sorts of fun...
blowdart
@blowdart: "BOSSDISTRACTION"
JAB
+5  A: 

We use Java with Eclipse and therefore the default Eclipse Tags TODO, FIXME and XXX. I use XXX when something is not really broken but very strange or should be done a different way.

musiKk
+1 for XXX usage. I use this tag the same way and actually it is very useful. I mark all workarounds and code that may fail in certain very special (and uncommon) conditions with this tag.
Piotr
So the XXX means the same as it does for XXX rated videos - "sensitive viewers should stay away, as you may be horrified and/or morally outraged by the content found within."
Peter Recore
@Peter Recore yeah, that could have been actually the origin of this tag:)
Piotr
The more interesting question is why is "XXX" used to signify danger or that we should exercise caution? It's tied to numerology and the Free Masons, but I'm at work and can't go surfing to learn more.
Greg
@Greg: http://en.wikipedia.org/wiki/Triple_XXX
JAB
+1  A: 

I use !!! for code that must be fixed before it's committed. I use ??? for strange/should be done differently/just doesn't look right (always with an explanation).

Hugh Brackett
+2  A: 

This might help a bit:

http://en.wikipedia.org/wiki/Comment_%28computer_programming%29#Tags

I usually add "NOTE:" to my vim color schemes because many don't include it.

Greg
Yes, that's nice. That section could benefit from some expansion, though. Perhaps when it's been hashed out here...
calmh
+4  A: 

These questions in SO might be also helpful:

Piotr
I'm going to consider this the answer, due to the excellent links. Specifically, it led me to http://www.python.org/dev/peps/pep-0350/ which is as close to a **real** answer as I'm going to get I think.
calmh
A: 

We use the Doxygen tag \todo.

http://www.doxygen.nl/commands.html#cmdtodo

Jesse Stimpson
+1  A: 

What ever you choose make sure you stick to it exactly. So if you go with // TODO make sure it's always that and never //TODO or // TO DO.

Why?

If it's just one string a simple search will find all places where it still exists in the code and you can more easily keep track of them.

Ideally you shouldn't have any - but we don't live (or work) in an ideal world.

ChrisF
Alternately, use an editor that can index them for you. Vim can do this with the todolist plugin, for example.
Daenyth
+1  A: 

There is not, though TODO is more common.

For a detailed research paper:

Storey, M.-A., J. Ryall, I. Bull, D. Myers, J. Singer, "TODO or To Bug: Exploring How Task Annotations Play a Role in the Work Practices of Software Developers," in Proceedings of the International Conference on Software Engineering, Leipzig, Germany, May 10-18, 2008.

Uri
Excellent reference. I'm going to see if I can find a copy online somewhere. Unfortunately, it seems restricted. :/
calmh
The ACM has been a little restrictive on PDFs recently. I might have a copy on my HD that I'll look for. There's a summary presentation you can find online: se.ethz.ch/teaching/2009-S/0276/slides/hugger.pdf
Uri