What is the meaning of #XXX in code comments?

前端 未结 10 714
轮回少年
轮回少年 2020-12-12 09:29

I have seen this a lot in code, even vim marks it as a special case. #TODO and #FIXME are two other fix markers vim highlights but what does

相关标签:
10条回答
  • 2020-12-12 09:51

    I use XXX because it's easier to type than TODO.

    XXX is for when you're in a hurry and will get back to this yourself.

    TODO is for when you have to hand it off to someone else.

    0 讨论(0)
  • 2020-12-12 09:53

    Probably it's for cases that you don't know how to handle.
    Check out this: List view of TODO/FIXME/XXX/HACK statements

    alt text http://editra-plugins.googlecode.com/svn/wiki/images/commentbrowser/cb_screenshot.PNG

    0 讨论(0)
  • 2020-12-12 10:00

    XXX is short for caveat which is slightly different from NOTE but quite similar to HACK. It may be a bug in a third party library / code which is being used and the code with // XXX: indicates that either it is workaround due to a bug in third party code or it could mean "caution" to someone looking / modifying the code to indicate why something is done in a certain way which otherwise may seem incorrect / inelegant in first look. HACK is generic term meaning a workaround for an issue which could be present in either your own code base or a third party library.

    0 讨论(0)
  • 2020-12-12 10:05

    From (old) Java code conventions:

    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)
  • 2020-12-12 10:06

    Have a look at PEP350. It explains all of TODO, XXX etc. I use it everyday when I can't remember exactly what one of the code tags means.

    0 讨论(0)
  • 2020-12-12 10:07

    I use // XXX so I don't have to remember line numbers. Instead I just search for the XXX when I want to return to that piece of code.

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