Where does the XXX comment prefix in Eclipse come from?

前端 未结 7 1992
Happy的楠姐
Happy的楠姐 2021-02-04 03:12

I was just wandering why is the prefix XXX ?

As far as I know its used for notes/reminders (or at least this is what I use it for and that is what the peopl

相关标签:
7条回答
  • 2021-02-04 03:28

    From the Hacker's Dictionary entry for "XXX":

    A marker that attention is needed. Commonly used in program comments to indicate areas that are kluged up or need to be. Some hackers liken `XXX' to the notional heavy-porn movie rating. Compare FIXME.

    0 讨论(0)
  • 2021-02-04 03:34

    It bugs me too, because XXX may also be used for masking input or format numbers,

    Thus creating multi markers warning when you describe amount format:

    /**
     * @param amount (XXX or XXX.XX)
     */
    public doSomething(String amount) {
    

    Multiple markers at this line

    -XXX or

    -XXX.XX)

    As @Jean-PhilippePellet suggested, you can remove it from

    Preferences -> Java -> Compiler -> Task Tags

    0 讨论(0)
  • 2021-02-04 03:39

    Various reasons:

    1. It's easy to search for.
    2. No collision, as no sane person would use it as a variable.
    3. It can used to mark code that needs e*X*tra special attention, dangerous code, not to be seen by underaged, etc.
    0 讨论(0)
  • 2021-02-04 03:39

    There's also a reference to it on Wikipedia:

    XXX to warn other programmers of problematic or misguiding code.

    0 讨论(0)
  • 2021-02-04 03:44

    From Sun/Oracle's Java code conventions, section 10.5.4:

    Use XXX in a comment to flag something that is bogus but works. Use FIXME to flag something that is bogus and broken.

    0 讨论(0)
  • 2021-02-04 03:48

    I've worked with a team where XXX was used to point out a "bug or task that was not yet entered in Trac.". After it was entered in Trac the comment would be changed to TODO with the ID appended.

    To Eclipse though, it's just a marker like TODO and FIXME. I imagine that it's originally used as a strong form of TODO. You usually see comments like this:

    // TODO: Need to optimize this once n becomes greater than 1000.
    

    But sometimes you'll have a comment like:

    // TODO: Fix SQL injection bug before production release!
    

    Unfortunately a quick grep wont make that SQL injection bug stand out among the 1000s of other TODOs. Using XXX here would help mark things that must be done before a milestone/release etc.

    0 讨论(0)
提交回复
热议问题