78

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?

3
  • 3
    There are plenty of references by which to answer this question: catb.org/jargon/html/X/XXX.html ; oracle.com/technetwork/java/javase/documentation/… ; c2.com/cgi/wiki?FixmeComment
    – pkh
    Sep 19, 2014 at 16:54
  • I use qaz personally. Easy to type and in 40 years of coding it has never occurred naturally in my code, so I can easily search for it. Rather than FixMe: or ToDo: I use it for quick experimental hacks which I can then easily reverse if they don't work out. But my qaz would never be committed to source control, whereas FixMe: or ToDo: or XXX could be. Mar 30, 2016 at 14:54
  • I've noticed that there are a lot of old XXX comments in Meteor's codebase...kind of a running commentary on its dirty secrets. And it seems like they use some tool to automatically strip them out from the code that gets shipped!
    – Andy
    Apr 1, 2017 at 16:13

9 Answers 9

77

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.

4
  • 12
    HACK would be an alternative to XXX.
    – Richard
    Apr 6, 2011 at 8:16
  • 2
    link is broken :(
    – Jack
    Sep 14, 2012 at 16:35
  • 1
    FIXME: link broken
    – onewhaleid
    Mar 22, 2018 at 1:15
  • 2
    HACK is not an alternative to XXX. The XXX comment flag has a long history, and essentially means something that works, but needs attention (bogus but works). Jun 24, 2019 at 15:03
102

It's a dirty piece of code ;)

4
  • 20
    Is this a funny answer or a funny and correct answer?
    – koenmetsu
    Mar 28, 2013 at 11:07
  • 4
    oh those naughty programmers
    – æ-ra-code
    Feb 12, 2015 at 11:30
  • @koenmetsu funny and accurate. It's wrong, but works well enough for now, so not entirely wrong. "Dirty" is an apt description for something which works but is not entirely correct (ie, clean).
    – Iiridayn
    Mar 6, 2019 at 19:18
  • Actually, it could easily be considered a funny and correct answer :) May 11, 2021 at 14:32
23

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.

13

It means nothing. It's just a sequence of characters that is visually distinctive (which makes it easy to scan for visually) 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.

1
  • 2
    Also easy to find with grep or the like
    – Zachary K
    Apr 6, 2011 at 8:10
7

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.

6

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)

0
4

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.


UPDATE Wikipedia currently (2016-03-30) says:

Such tags differ widely, but might include:

  • ...
  • XXX - warn other programmers of problematic or misguiding code

Note the clear caveats in the original text. The XXX could be construed as an allusion to the "XXX" that you see on poison and/or moonshine bottles in classic comics, cartoons, etc.

2

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.

0

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.

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