你遇到过的源代码中最好的注释是什么?
当前回答
我前几天刚检查过这个…
/// <STERNLY-WORDED-WARNING>
/// Pay attention to this or I will hunt you down.
/// ...
/// </STERNLY-WORDED-WARNING>
(“……”== "专有的东西,我不能发布")。我只是喜欢我的措辞严厉的警告元素。
其他回答
// I don't know why I need this, but it stops the people being upside-down
x = -x;
我喜欢GNU双utils中的一些注释。这个来自BFD som.c:
/* You'll never believe all this is necessary to handle relocations
for function calls. Having to compute and pack the argument
relocation bits is the real nightmare.
If you're interested in how this works, just forget it. You really
do not want to know about this braindamage. */
这个也是:
/* Don't ask about these magic sequences. I took them straight
from gas-1.36 which took them from the a.out man page. */
...
/* Keep track of exactly where we are within a particular
space. This is necessary as the braindamaged HPUX
loader will create holes between subspaces *and*
subspace alignments are *NOT* preserved. What a crock. */
另一个:
/* We will NOT put a fucking timestamp in the header here. Every
time you put it back, I will come in and take it out again. ... */
从气体:
/* Yes this is ugly (storing the broken_word pointer
in the symbol slot). Still, this whole chunk of
code is ugly, and I don't feel like doing anything
about it. Think of it as stubbornness in action. */
// The following strings are meant to be funny. Do not edit these strings // unless you are funny, too. If you don't know if you're funny, you're // not funny. If fewer than 2 people unrelated to you have told you that // you're funny, you're not funny.
不记得我在哪里见过这些了
long time; /* know C */
and(在代码中创建某种UNIX守护进程):
/* Be a real daemon: fork myself and kill my parent */
{
This is a gathering place for all unit tests.
Create a TUnitTestWrapper, then call "RunAllUnitTests".
This class will create an instance of each thing to be tested, and call each of
their unit tests.
It does not really do any testing on it's own; it just gives a common place from
which to call everyone else's tests.
This way, one day, we can automate our testing with each build. [Cue laughter]
}