What is the meaning of #XXX in code comments?

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

    I believe while FIXME is for the developer, and HACK is for the maintainer, XXX is for the user.

    For example, if you ignore the XXX and call this function elsewhere, without understanding how it works, something unexpected can happen, and the person dealing with this issue will be unhappy (at least the one who added the XXX thinks so). You may think the problem will be gone if you just don't use this function.

    But for FIXME, you will feel worthy to just fix the code to make it work. And for HACK, you may have no better choice even if you don't use it.

    If you wrote XXX on your own code and someone used it, you may feel unhappy for reasons like you completely rewrote that code, and it then behave in completely different ways, and you broke someone else's code. But if you left a FIXME or TODO instead, you won't care so much.

提交回复
热议问题