你遇到过的源代码中最好的注释是什么?
当前回答
在一组相当长且复杂的while循环和if块的末尾,开发人员插入了最后的注释:
else
{
// wobbly wilson said this would *never* happen!!
}
机智和讽刺的简洁混合:)
其他回答
#!/usr/bin/sh
# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
# All Rights Reserved
# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T
# The copyright notice above does not evidence any
# actual or intended publication of such source code.
#ident "@(#)false.sh 1.6 93/01/11 SMI" /* SVr4.0 1.3 */
exit 255
从SunOS 5.9即Solaris 9获取(/usr/bin/false)
// Added because boss changed his mind : 20020111,20020501,20020820, ...
// Commented out because boss changed his mind : 20020201,20020614,20020908, ...
在ETL脚本之间的主要黑客RPG数据库和SQL Server一个。我大概有10到20次这样的评论……
从一个遗留的Perl CGI脚本:
# This is convoluted and evil, sorry.
对于我编写的memcache包装器/处理程序接口模式类,我实现了以下方法。
/**
* Do not use, ever - left in place for testing purposes
*/
function I_David_WillHuntYouDownAndHurtYou_Badly_IfIFindThisUsedAnyWhereInTheAppLibrary(){
...
}
这基本上是一个超级核函数,它告诉所有单独的memcache服务完全刷新自己,并从我用于键的单个名称空间计数器(例如{_counter_key value}_)重新开始。{_counter_key value})
Another minor novella I wrote was for an automated downloader for a data vendor, detailing how much I hated this vendor and went to great lengths of postulating that their infrastructure's batch system was run by a gerbil, running on a wheel and after so many revolutions of the wheel the next queued task would be started. It was written over the course of 6 months of adding additional exception handling, estoric checks like ( if we got 768 Bytes of \s characters, that means the query to their DB timed out and the spaces are the result of empty failure print statements.
// fix for groupid > 9
// if groupid ever gets to 100 everything will break (again)
if (groupid < 10) {
groupid = "0" + groupid;
}