Stack Overflow 上有个关于你见过的最好(gao)的注释的帖子:What is the best comment in source code you have ever encountered?
摘录其中一部分贴出来:
脑洞大开
/** * For the brave souls who get this far: You are the chosen ones, * the valiant knights of programming who toil away, without rest, * fixing our most awful code. To you, true saviors, kings of men, * I say this: never gonna give you up, never gonna let you down, * never gonna run around and desert you. Never gonna make you cry, * never gonna say goodbye. Never gonna tell a lie and hurt you. */
历史的教训
// // Dear maintainer: // // Once you are done trying to 'optimize' this routine, // and have realized what a terrible mistake that was, // please increment the following counter as a warning // to the next guy: // // total_hours_wasted_here = 42 //
忠告
/* * You may think you know what the following code does. * But you dont. Trust me. * Fiddle with it, and youll spend many a sleepless * night cursing the moment you thought youd be clever * enough to "optimize" the code below. * Now close this file and go play with something else. */
“哈哈”太贱了
Exception up = new Exception("Something is really wrong."); throw up; //ha ha
这条我忍不住笑了
//When I wrote this, only God and I understood what I was doing //Now, God only knows
这条适合处女座
// Autogenerated, do not edit. All changes will be undone.
笑点低系列
// sometimes I believe compiler ignores all my comments
为这位老哥默哀
// I dedicate all this code, all my work, to my wife, Darlene, who will // have to support me and our three children and the dog once it gets // released into the public.
吐槽
// somedev1 - 6/7/02 Adding temporary tracking of Login screen // somedev2 - 5/22/07 Temporary my ass
喝醉了也要写注释也是蛮敬业的
// drunk, fix later
犯贱系列
#define TRUE FALSE //Happy debugging suckers
Catch (Exception e) { //who cares? }
/** * Always returns true. */ public boolean isAvailable() { return false; }
迷之自信
try { } finally { // should never happen }
跟着唱吧
long long ago; /* in a galaxy far far away */
其它
//This code sucks, you know it and I know it. //Move on and call me an idiot later.
作者:ILLYM
链接:https://www.zhihu.com/question/29962541/answer/46519750