你遇到过的源代码中最好的注释是什么?
当前回答
# There is a bug in the next line. $searchParameters != {} will always return true, because {} is creating
# a new hash reference on the fly, and the inequality operater is comparing the memory location of it
# to the memory location of $searchParameters, and they will always be different.
# This means that the following code will always get executed as long as $nodes is defined.
# I'm leaving it there because it has always been there, and although I'm sure it was originally meant to
# mean %$searchParameters (essentially "is this hash not empty"), I'm afraid to change it.
if ( $nodes && $searchParameters != {} )
{
其他回答
我最喜欢的是已故的Paul DiLascia:
//作者:如果这段代码工作,它是由Paul DiLascia写的。如果不是,我就不知道是谁写的了。
//我穿上长袍,戴上巫师帽……
DataRow[] foundrows = FilterCalendarEntriesBecauseDotNETIsFuckedUp(tbtemp,CalDate);
不是注释,而是一个有趣的函数名
从泄露的Win2K源代码:
//这次黑客入侵的规模堪比国家债务的规模。
我在一个充满显式怪异类型转换的函数中见过这段代码:
// Since today's CPUs are really fast, this is dedicated to those who said:
// " You can't use Moore's Law as an excuse to write bad software. "
代码太可怕了:)
推荐文章
- Jenkins:注释可以添加到Jenkins文件中吗?
- TypeScript注释的语法记录在哪里?
- CSV文件可以有注释吗?
- 什么是自文档化代码?它能取代文档化良好的代码吗?
- 在erb中添加注释的最佳方法
- 为什么Python没有多行注释?
- 我应该在批处理文件中使用哪种注释风格?
- 如何在Office VBA编辑器中注释和取消注释代码块
- “# noqa”在Python注释中是什么意思?
- 我可以向pip需求文件添加注释吗?
- 你遇到过的源代码中最好的注释是什么?
- 在Bash中创建多行注释的方法?
- 如何评论在Vim的配置文件:“。vimrc”?
- 如何为多行命令放一行注释
- 我如何向包添加注释。Json用于NPM安装?