代码注释(code comments)

本文介绍了代码注释中常见的标记,如FIXME、HACK、TODO等,用于标注需要修正、临时解决方案或待办事项的代码。同时也讨论了代码风格的重要性,尤其是在团队开发中保持一致性、非侵入性、易修改和难破坏的注释风格。专家Allen Holub提倡对齐注释的左侧边缘,以提高代码可读性。
摘要由CSDN通过智能技术生成

常见的代码tag:

FIXME - should be corrected.
HACK - a workaround.
TODO - something to be done.
UNDONE - a reversal or “roll back” of previous code.
XXX - warn other programmers of problematic or misguiding code
UX - user experience, notice about non-trivial code.

例如:

/* TODO: How about auto-correcting small spelling errors? */
    /* FIXME: This won't work if the file is missing. */
    /* XXX: This method badly needs refactoring: should switch by core type. <mbp> */

常见的代码风格:
There are many stylistic alternatives available when considering how comments should appear in source code. For larger projects involving a team of devel

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值