你遇到过的源代码中最好的注释是什么?
当前回答
从2004年的Windows泄露事件来看,
__inline BOOL
SearchOneDirectory(
IN LPSTR Directory,
IN LPSTR FileToFind,
IN LPSTR SourceFullName,
IN LPSTR SourceFilePart,
OUT PBOOL FoundInTree
)
{
//
// This was way too slow. Just say we didn't find the file.
//
*FoundInTree = FALSE;
return(TRUE);
}
其他回答
//休斯顿,我们有麻烦了
不是代码注释,而是SVN在同一个文件上提交注释:
第一次提交(在测试人员返回结果后,再进行数十次提交):
Squashed some IPR mod bugs. The were big and juicy ones, too.
2日提交:
Squashed some more mod bugs. Those are some nasty bugs, them mod bugs...
3rd:
Squashed some more mod bugs. They are like cockroaches: they'll live through a nuclear war.
4th:
Squashed some more John bugs. They too are like cockroaches: they appear anywhere John goes. Wait. That doesn't sound right.
5:
Same John bug. It didn't die, just played 'possum.
是的,我厌倦了"修复bug"
// barcore.cpp - MFC
//.....
HBRUSH CControlBar::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
LRESULT lResult;
if (pWnd->SendChildNotifyLastMsg(&lResult))
return (HBRUSH)lResult; // eat it
//......
// Eat it - just like eat this.
从C #
#region Hack - Shield Eyes Before Expanding
/// <summary>
/// A single uint with all of the bits set to represent the different tracing
/// </summary>
/// <remarks>
/// Ugly I know, so if you can think of a better way, feel free to rewrite.
/// </remarks>
[Browsable(false)]
public uint TraceBitfield
{
// Snip
}
#endregion
我只是在一个非常简单的大学课程测试c++程序中碰到了这个。
我在评论一个类。
在析构函数中…
// Choose! Choose the form of the Destructor!
// The choice is made! The Traveler has come!