你遇到过的源代码中最好的注释是什么?
当前回答
不是一个评论,而是一个goto标签
ICantBelieveImUsingAGoto:
其他回答
/* Look not upon this file lest your eyes be burnt from your head. */
我能说什么呢?我当时是实习生,夏天快结束了。我们可以说,我对我的文件责任缺乏认真的承诺。
i++; // increment variable i
在linux 1.0内核调度器(schedule .c)中:
Dijkstra可能讨厌我。
/*
* 'schedule()' is the scheduler function. It's a very simple and nice
* scheduler: it's not perfect, but certainly works for most things.
* The one thing you might take a look at is the signal-handler code here.
*
* NOTE!! Task 0 is the 'idle' task, which gets called when no other
* tasks can run. It can not be killed, and it cannot sleep. The 'state'
* information in task[0] is never used.
*
* The "confuse_gcc" goto is used only to get better assembly code..
* Dijkstra probably hates me.
*/
asmlinkage void schedule(void)
(…)
// If this comment is removed the program will blow up
一个文件中5000多行代码中很少的一些注释 事实上,我和那个为自己的编码风格辩护的程序员有过一次争论…… 无可奉告! 没有评论;-)(或者很少) 遗憾的是,这是产品代码。
offset=1;
for (i=0;i<=len;i++)
{
if ((i!=0)&&(i<len)) //-3
{
switch(mess[i])
{
case ETX:
case ETB:
case DLE:
buf[offset]=DLE;
offset++;
break;
}
}
buf[offset]=mess[i];
offset++;
}
我喜欢这个开关!
for (n=0;n<offset;n++)
{
Sleep(TR); //Modif A
Sleep(T);//
FWriteFile(hCom,buf+n,1,&dwMot,NULL);
if (ECHO)
FReadFile(hCom,tab,1,&dwMot,NULL);
}
不,没有注释解释什么“修改A”是在标题。
if (GetFileSize(hSlotFile,NULL)==3600) //5*720
720是多少?