What is the meaning of #XXX in code comments?

前端 未结 10 743
轮回少年
轮回少年 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 10:16

    • NOTE: Description of how the code works (when it isn't self evident).
    • XXX: Warning about possible pitfalls, can be used as NOTE:XXX:.
    • HACK: Not very well written or malformed code to circumvent a problem/bug. Should be used as HACK:FIXME:.
    • FIXME: This works, sort of, but it could be done better. (usually code written in a hurry that needs rewriting).
    • BUG: There is a problem here.
    • TODO: No problem, but additional code needs to be written, usually when you are skipping something.

    At least this is how I was taught about these tags. Basically the first two (NOTE and XXX) are used for information and no action is required. While the last three (FIXME, BUG and TODO) do require action. HACK is somewhere in between (and hardly ever used I think?).

提交回复
热议问题