Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

What do people generally mean whenever you see XXX in a comment. Occasionally, I'll see a comment like this:

# XXX - This widget really should frobulate the whatsit

Of course, I can tell what the comment means, but what does the XXX generally mean? Is it saying "This is a hack" or maybe "Perhaps we should revisit this later"? Or is it saying something else entirely?

share|improve this question
1  
Probably denotes an obscenity in the code ;-) –  Michael Easter Apr 6 '11 at 0:38
12  
Vin Diesel was here. –  JB King Apr 6 '11 at 1:35
2  
If there was extra X, it would mean "beer in code" ... for some definitions of "beer" :-) –  Stephen C Apr 6 '11 at 3:15
5  
XXX code you'd be ashamed to show your mother...if your mother knew what good code and bad code is. –  Mike Brown Apr 6 '11 at 4:13
1  
Hugs ? –  Reno Apr 6 '11 at 5:28

12 Answers 12

up vote 27 down vote accepted

What XXX represents, depends on the author of the code. In general, it is used as a marker for code that requires attention.

However, this web page states a somewhat different train of thought:

XXX : used to flag something that is bogus but works FIXME : used to flag something that is bogus and broken

I guess this further shows that its meaning is not well defined and is used differently.

share|improve this answer
4  
HACK would be an alternative to XXX. –  Richard Apr 6 '11 at 8:16
1  
link is broken :( –  Jack Sep 14 '12 at 16:35

IIRC it is an annotation that predates and has similar meaning to TODO or FIXME annotations. It's quite common in vim's source, for instance.

share|improve this answer

It's a dirty piece of code ;)

share|improve this answer
5  
YEEEEEEEEEEEAAHHHHH- –  Maxpm Jul 4 '11 at 7:09
2  
Is this a funny answer or a funny and correct answer? –  KoMet Mar 28 '13 at 11:07

It means nothing. It's just a sequence of characters that is visually distinctive (which makes it easy to scan for manually) and unlikely to appear in either code or comments (which makes it easy to search for programatically).

So, it is used as a marker to flag comments that need to be easily searchable. Usually, it marks a piece of code that needs to be revisited.

share|improve this answer
    
Also easy to find with grep or the like –  Zachary K Apr 6 '11 at 8:10

It could be stylistic, or it could be a way of adding "bookmarks" to code, but it doesn't have any obvious meaning.

share|improve this answer

Xavier Xander Xiang checked in that code and used his initials?

share|improve this answer

Per Wikipedia: "XXX to warn other programmers of problematic or misguiding code." -- which might be pulled from containers of poison that say "xxx" on them; super old school.

If it's a TODO note, here's a related blog post on it called, TODO or not TODO, which covers using GREP to sort comments by date, owner, etc.

share|improve this answer

It is most likely a character sequence which does not occur in regular code, meaning that it is easily searchable from a command line:

ravn:tmp ravn$ echo XXXX This is very bad > processor.c
ravn:tmp ravn$ echo XXXX Verify defaults before going in production > main.c
ravn:tmp ravn$ grep -R XXXX .
./main.c:XXXX Verify defaults before going in production
./processor.c:XXXX This is very bad
ravn:tmp ravn$ 

(example is for Unix, I believe "findstr" does the same under Microsoft Windows)

share|improve this answer
    
+1 for telling me about findstr! How did I not know about this? –  yatima2975 Apr 6 '11 at 11:45

but what does the XXX generally mean? Is it saying "This is a hack" or maybe "Perhaps we should revisit this later"? Or is it saying something else entirely?

Any of the above.

The choice of XXX versus TODO or FIXME or HACK or something else is not governed by any strong rules or conventions. Basically, it means whatever the person who put it there intended it to mean. It may be obvious ... or it may be totally opaque to you.

share|improve this answer

It is most probably a marker that can later be found. Unlike TODO or FIXME or the alike, XXX is very rarely found in any word or construct, therefore making it perfect for a marker that will stand alone when files are being searched through.

share|improve this answer

Where I am originally from we use XXX (and then YYY, ZZZ) for numbers that we do not know them yet, for example: add XXX to YYY to find the result, then add 10%.

Originates from equations at school where 'x' is the unknown variable.

share|improve this answer

XXX is just there as a marker for easy search.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.