你遇到过的源代码中最好的注释是什么?


当前回答

来自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

其他回答

// I don't know why I need this, but it stops the people being upside-down

x = -x;

来自Linux内核源代码:

linux /包括/ asm-i386 / hw_irq。h:

/*
 * subtle. orig_eax is used by the signal code to distinct between
 * system calls and interrupted 'random user-space'. Thus we have
 * to put a negative value into orig_eax here. (the problem is that
 * both system calls and IRQs want to have small integer numbers in
 * orig_eax, and the syscall code has won the optimization conflict ;)
 *
 * Subtle as a pigs ear.  VY
 */

看这个:

'On Error Goto Hell.
#define SHIT_HAPPENED (BASE + 1)   /* generic shit happened */

//我穿上长袍,戴上巫师帽……