你遇到过的源代码中最好的注释是什么?
当前回答
options.BatchSize = 300; //Madness? THIS IS SPARTA!
其他回答
// (c) 2000 Applied Magic, Inc.
// Unauthorized use punishable by torture, mutilation, and vivisection.
啊,我一直很喜欢这个……
在一组相当长且复杂的while循环和if块的末尾,开发人员插入了最后的注释:
else
{
// wobbly wilson said this would *never* happen!!
}
机智和讽刺的简洁混合:)
Dennis M Ritchie在这里有一个关于一些古老UNIX注释的页面
来自c#中的单元测试类:
#region quis custodiet ipsos custodes?
[Fact]
public void TestPositive()
{
Assert.Equal(4, 2 + 2);
}
[Fact]
public void TestNegative()
{
Assert.Equal(5, 2 + 2);
}
#endregion
场景一:
return 0; // Happy ending
场景二:
int32_t Interpolate1DSignal(
Array1D<float64>::Handle hfInputSamples, // samples to be interpolated
Array1D<float64>::Handle hfInterpolationFilter, // polyphase filter coefficients,
int32_t iFilterInterpolationFactor, // # of "rows" in polyphase filter
int32_t iFilterLength, // Length of each row in filter
float64 fInterpolationFactor, // Factor to interpolate the
// signal by
float64 fTimingOffset, // Offset into the signal (units
// of samples)
Array1D<float64>::Handle hfOutputSamples // left as an exercise for the reader
);