30 多个有内味道且笑死的人代码注释

开发 前端
代码注释,有些人说它太丑,也有些人说它是标准和良好的做法。在本文中, 列出了一些在编程中遇到的有趣的代码注释。

[[339181]]

代码注释,有些人说它太丑,也有些人说它是标准和良好的做法。在本文中, 列出了一些在编程中遇到的有趣的代码注释。

注释 1

  1. // Weed Effect !  
  2.  
  3. 这是杂草效应的意思?不是很懂,有谁知道,可以留言一下。 

注释 2

  1. /**** 原文 *****/ 
  2. //The following code was written by <developer name>. 
  3. // Unless it doesn't workthen I have no idea who wrote it. 
  4.  
  5. /**** 自译 *****/ 
  6. // 以下代码是由<developer name>编写的。 
  7. // 除非它不起作用,否则我不知道是谁写的。 

注释 3

  1. /**** 原文 *****/ 
  2. // Ad Index scheming and plotting - Those with 
  3. // heart conditions are advised to not continue 
  4.  
  5. /**** 自译 *****/ 
  6. // 广告索引的设计和绘图模块 
  7. // 建议不要深入阅读,否则容得得心脏病 

注释 4

  1. /**** 原文 *****/ 
  2. // nobody read comments! 
  3.  
  4. /**** 自译 *****/ 
  5. // 没人会读的注释 

注释 5

  1. /**** 原文 *****/ 
  2. i++; // increment i 
  3.  
  4. /**** 自译 *****/ 
  5. i++; // 自增 i 

注释 6

  1. /**** 原文 *****/ 
  2. // Magic. Do not touch. 
  3.  
  4.  
  5. /**** 自译 *****/ 
  6. // 这里已经结界,不要碰. 

注释 7

  1. /**** 原文 *****/ 
  2. // sometimes I believe compiler ignores all my comments 
  3.  
  4. /**** 自译 *****/ 
  5. // 有时我相信编译器会忽略我的所有注释 

注释 8

  1. /**** 原文 *****/ 
  2. // I am not responsible of this code. 
  3. // They made me write it, against my will. 
  4.  
  5. /**** 自译 *****/ 
  6. // 我对此代码不承担任何责任。 
  7. // 是他们强迫我让我写的,这已违背了我的意愿。 

注释 9

  1. /**** 原文 *****/ 
  2. //  
  3. // Dear maintainer: 
  4. //  
  5. // Once you are done trying to 'optimize' this routine, 
  6. // and have realized what a terrible mistake that was, 
  7. // please increment the following counter as a warning 
  8. // to the next guy: 
  9. //  
  10. // total_hours_wasted_here = 42 
  11.  
  12. /**** 自译 *****/ 
  13. // 亲爱的程序媛 
  14. //  
  15. // 一旦你尝试“优化”此代码,并意识到这是一个可怕的错误, 
  16. // 请增加以下计数器,以警告下一个人 
  17. //  total_hours_wasted_here = 42 

注释 10

  1. /**** 原文 *****/ 
  2.  
  3. To understand recursion, see the bottom of this file 
  4. At the bottom of the file 
  5. To understand recursion, see the top of this file 
  6.  
  7.  
  8. /**** 自译 *****/ 
  9.  
  10. # 要了解递归,请参见此文件的底部 
  11.  
  12. 在文件的底部 
  13.  
  14. # 要了解递归,请参见此文件的顶部 

注释 11

  1. /**** 原文 *****/ 
  2.  
  3. // I will give you two of my seventy-two virgins if you can fix this. 
  4.  
  5. /**** 自译 *****/ 
  6. // 如果你能解决这个问题,我就把我七十二个处女中的两个给你。 

注释 12

  1. /**** 原文 *****/ 
  2. //Dear future me. Please forgive me.  
  3. //I can't even begin to express how sorry I am. 
  4.  
  5.  
  6. /**** 自译 *****/ 
  7. // 你好,未来帅气的我,请原谅我。 
  8. // 我现在无法表达我的歉意,因为我写下了这段代码。 

注释 13

  1. /**** 原文 *****/ 
  2. //private instance variable for storing age 
  3. public static int age; 
  4.  
  5. /**** 自译 *****/ 
  6. // 用于存储年龄的私有实例变量 
  7. public static int age; 

注释 14

  1. /**** 原文 *****/ 
  2. const int TEN=10; // s if the value of 10 will fluctuate... 
  3.  
  4.  
  5. /**** 自译 *****/ 
  6. const int TEN=10; // 10 是会改变的值 

注释 15

  1. /**** 原文 *****/ 
  2.  
  3. /* You are not meant to understand this */ 
  4.  
  5.  
  6. /**** 自译 *****/ 
  7.  
  8. /* 你不应该理解这一点 */ 

注释 16

  1. /**** 原文 *****/ 
  2. /* 
  3. * TODO: Remove this function 
  4.  
  5. function remove($customer_id) 
  6.     { 
  7.         $this->Customer->remove($id); 
  8.     } 
  9.  
  10. */ 
  11.  
  12.  
  13. /**** 自译 *****/ 
  14. /* 
  15. * TODO: 删除函数 
  16.  
  17. function remove($customer_id) 
  18.     { 
  19.         $this->Customer->remove($id); 
  20.     } 
  21.  
  22. */ 

注释 17

  1. /**** 原文 *****/ 
  2. //When I wrote this, only God and I understood what I was doing 
  3. //Now, God only knows 
  4.  
  5.  
  6. /**** 自译 *****/ 
  7.  
  8. // 当我写这段代码,只有上帝和我知道这是在做什么 
  9. ... 
  10.  
  11. // 现在,只有上帝知道这段代码在做什么 

注释 18

  1. /**** 原文 *****/ 
  2.  
  3. // drunk, fix later 
  4.  
  5. /**** 自译 *****/ 
  6.  
  7. // 喝醉了,待会解决 

注释 19

  1. /**** 原文 *****/ 
  2.  
  3. // I'm sorry. 
  4.  
  5. /**** 自译 *****/ 
  6.  
  7. // 我很抱歉 

注释 20

  1. /**** 原文 *****/ 
  2.  
  3. // I am not responsible of this code. 
  4.  
  5. /**** 自译 *****/ 
  6.  
  7. // 我对此代码不承担任何责任。 

注释 21

  1. /**** 原文 *****/ 
  2. // I have to find a better job 
  3.  
  4. /**** 自译 *****/ 
  5.  
  6. // 我必须找到更好的工作 

注释 22

  1. /**** 原文 *****/ 
  2.  
  3. // Joe is sorry 
  4. A few hundred lines later... 
  5. // Harry is sorry too 
  6.  
  7. /**** 自译 *****/ 
  8.  
  9. // 老五抱歉了 
  10.  
  11. 写了几百行代码之后... 
  12.  
  13. // 小五对不住了 

注释 23

  1. /**** 原文 *****/ 
  2. # Christmas tree initializer   
  3.     toConnect = []   
  4.     toRead =   [  ]   
  5.     toWrite = [    ]    
  6.     primes = [      ]   
  7.     responses = {}   
  8.     remaining = {} 
  9.      
  10.      
  11. /**** 自译 *****/ 
  12.  
  13. # 圣诞树初始化器 
  14.     toConnect = []   
  15.     toRead =   [  ]   
  16.     toWrite = [    ]    
  17.     primes = [      ]   
  18.     responses = {}   
  19.     remaining = {}  

注释 24

  1. /**** 原文 *****/ 
  2.  
  3. Catch (Exception e) { 
  4.  // who cares? 
  5.  
  6. /**** 自译 *****/ 
  7.  
  8. Catch (Exception e) { 
  9.  // 管它呢? 

注释 25

  1. /**** 原文 *****/ 
  2.  
  3. // IE7 update. this is still bad code, but IE8 is probably a long way off :) 
  4.  
  5. /**** 自译 *****/ 
  6.  
  7. IE7更新,这仍然是错误的代码,看来 IE8 还有很长的路要走:) 

注释 26

  1. /**** 原文 *****/ 
  2.  
  3. // If this code works, it was written by Paul DiLascia. If not, I don't know 
  4.  
  5. /**** 自译 *****/ 
  6.  
  7. // 如果这个代码有效的话,它就是由 前端小智 编写的。如果出错了,我也不知道是谁写的。 

注释 27

  1. /**** 原文 *****/ 
  2.  
  3. // This comment is self explanatory. 
  4.  
  5. /**** 自译 *****/ 
  6.  
  7. // 这个注释不言自明。 

注释 28

  1. /**** 原文 *****/ 
  2.  
  3. int main(void) 
  4. /* Program starts here */ 
  5.  
  6. /**** 自译 *****/ 
  7.  
  8. int main(void) 
  9. /* 程序从这里开始 */ 

注释 29

  1. /**** 原文 *****/ 
  2.  
  3. // I am not sure if we need this, but too scared to delete
  4.  
  5. /**** 自译 *****/ 
  6.  
  7. // 我不确定我们是否需要这个,但又害怕删除 

注释 30

  1. /**** 原文 *****/ 
  2. /** 
  3.  * Always returns true
  4.  */ 
  5. public boolean isAvailable() { 
  6.     return false
  7.  
  8.  
  9. /**** 自译 *****/ 
  10. /** 
  11.  * 总是返回 true
  12.  */ 
  13. public boolean isAvailable() { 
  14.     return false

注释 31

  1. /**** 原文 *****/ 
  2.  
  3. // Autogenerated, do not edit. All changes will be undone. 
  4.  
  5. /**** 自译 *****/ 
  6.  
  7. // 自动生成,不要编辑。所有的更改都将被撤销。 

注释 32

  1. /**** 原文 *****/ 
  2.  
  3. // hack for ie browser (assuming that ie is a browser) 
  4.  
  5.  
  6. /**** 自译 *****/ 
  7. // 破解ie浏览器(假设ie是一个浏览器) 

注释 33

  1. /**** 原文 *****/ 
  2.  
  3. /////////////////////////////////////// this is a well commented line 
  4.  
  5. /**** 自译 *****/ 
  6.  
  7. /////////////////////////////////////// 这是一个很好的注释 

注释 34

  1. /**** 原文 *****/ 
  2.  
  3. // Mr. Compiler, please do not read this. 
  4.  
  5. /**** 自译 *****/ 
  6.  
  7. // 编译先生,请不要读取这个 

注释 35

  1. /**** 原文 *****/ 
  2.  
  3. // All bugs added by David S. Miller 
  4.  
  5. /**** 自译 *****/ 
  6.  
  7. // 所有 bug 都是由 老王 添加的 

注释 36

  1. /**** 原文 *****/ 
  2.  
  3. //If you're reading this, then my program is probably a success 
  4.  
  5.  
  6. /**** 自译 *****/ 
  7.  
  8. // 如果你现在在认真详细的阅读这段代码,那么写的这段代码应该是没有问题的。 

注释 37

  1. /**** 原文 *****/ 
  2.  
  3. Catch (Exception e) { 
  4.     //eat it 
  5.  
  6. /**** 自译 *****/ 
  7.  
  8. Catch (Exception e) { 
  9.     // 吃掉它 

注释 38

  1. /**** 原文 *****/ 
  2.  
  3. //todo: never to be implemented 
  4.  
  5. /**** 自译 *****/ 
  6.  
  7. // todo:永远不会执行 

注释 39

  1. /**** 原文 *****/ 
  2.  
  3. // simply copied from another code 
  4.  
  5. /**** 自译 *****/ 
  6.  
  7. // 别问,问我也是从另一个代码拷贝过来的 

注释 40

  1. /**** 原文 *****/ 
  2.  
  3. //Please comment on your source code 
  4.  
  5. /**** 自译 *****/ 
  6.  
  7. // 拜托啦,请把你写的代码注释一下 

注释 41

  1. /**** 原文 *****/ 
  2. as you can see: I comment the code! 
  3.  
  4.  
  5. /**** 自译 *****/ 
  6.  
  7. # 如你所见:我注释了代码! 

注释 42

  1. /**** 原文 *****/ 
  2.  
  3. // if i ever see this again i'm going to start bringing guns to work 
  4.  
  5. /**** 自译 *****/ 
  6.  
  7. // 如果我再看到这个,我会带枪去工作 

注释 43

  1. def format_ticket_content(text, recursive = true
  2.   if text.is_a?(TicketNote) 
  3.     note = text 
  4.     text = note.content 
  5.   else 
  6.     note = nil 
  7.   end 
  8.  
  9.   ## Safety pig has arrived! 
  10.   text = h(text) 
  11.   ##                               _ 
  12.   ##  _._ _..._ .-',     _.._(`)) 
  13.   ## '-. `     '  /-._.-'    ',/ 
  14.   ##    )         \            '. 
  15.   ##   / _    _    |             \ 
  16.   ##  |  a    a    /              | 
  17.   ##  \   .-.                     ;   
  18.   ##   '-('' ).-'       ,'       ; 
  19.   ##      '-;           |      .' 
  20.   ##         \           \    / 
  21.   ##         | 7  .__  _.-\   \ 
  22.   ##         | |  |  ``/  /`  / 
  23.   ##        /,_|  |   /,_/   / 
  24.   ##           /,_/      '`-' 
  25.   ## 

注释 44

  1. /**** 原文 *****/ 
  2.  
  3. long long ago; /* in a galaxy far far away */ 
  4.  
  5.  
  6. /**** 自译 *****/ 
  7.  
  8. long long ago; /* 在遥远的星系中 */ 

注释 45

  1. /**** 原文 *****/ 
  2. try { 
  3.  
  4. } finally { // should never happen  
  5.  
  6.  
  7. /**** 自译 *****/ 
  8. try { 
  9.  
  10. } finally { // 这里永远不会被执行 
  11.  

注释 46

  1. /**** 原文 *****/ 
  2.  
  3. /* Ah ah ah! You'll never understand why this one works. */ 
  4.  
  5.  
  6. /**** 自译 *****/ 
  7.  
  8. // 啊啊啊!你永远都不会明白为什么这个方法有效。 

注释 47

  1. /**** 原文 *****/ 
  2. // this formula is rightwork out the math yourself if you don't believe me 
  3.  
  4. /**** 自译 *****/ 
  5.  
  6. // 这个公式是正确的,如果你不相信我,自己动手算一下 

注释 48

  1. /**** 原文 *****/ 
  2.  
  3. // This was clearly written under duress 
  4.  
  5. /**** 自译 *****/ 
  6.  
  7. // 这显然是在胁迫下写的 

注释 49

  1.                              .='  ' .`/,/!(=)Zm.            
  2.                .._,,._..  ,-`- `,\ ` -` -`\\7//WW.          
  3.           ,v=~/.-,-\- -!|V-s.)iT-|s|\-.'   `///mK%.         
  4.         v!`i!-.e]-g`bT/i(/[=.Z/m)K(YNYi..   /-]i44M.        
  5.       v`/,`|v]-DvLcfZ/eV/iDLN\D/ZK@%8W[Z..   `/d!Z8m        
  6.      //,c\(2(X/NYNY8]ZZ/bZd\()/\7WY%WKKW)   -'|(][%4.       
  7.    ,\\i\c(e)WX@WKKZKDKWMZ8(b5/ZK8]Z7%ffVM,   -.Y!bNMi       
  8.    /-iit5N)KWG%%8%%%%W8%ZWM(8YZvD)XN(@.  [   \]!/GXW[       
  9.   / ))G8\NMN%W%%%%%%%%%%8KK@WZKYK*ZG5KMi,-   vi[NZGM[       
  10.  i\!(44Y8K%8%%%**~YZYZ@%%%%%4KWZ/PKN)ZDZ7   c=//WZK%!       
  11. ,\v\YtMZW8W%%f`,`.t/bNZZK%%W%%ZXb*K(K5DZ   -c\\/KM48        
  12. -|c5PbM4DDW%f  v./c\[tMY8W%PMW%D@KW)Gbf   -/(=ZZKM8[        
  13. 2(N8YXWK85@K   -'c|K4/KKK%@  V%@@WD8e~  .//ct)8ZK%8`        
  14. =)b%]Nd)@KM[  !'\cG!iWYK%%|   !M@KZf    -c\))ZDKW%`         
  15. YYKWZGNM4/Pb  '-VscP4]b@W%     'Mf`   -L\///KM(%W!          
  16. !KKW4ZK/W7)Z. '/cttbY)DKW%     -`  .',\v)K(5KW%%f           
  17. 'W)KWKZZg)Z2/,!/L(-DYYb54%  ,,`, -\-/v(((KK5WW%f            
  18.  \M4NDDKZZ(e!/\7vNTtZd)8\Mi!\-,-/i-v((tKNGN%W%%             
  19.  'M8M88(Zd))///((|D\tDY\\KK-`/-i(=)KtNNN@W%%%@%[            
  20.   !8%@KW5KKN4///s(\Pd!ROBY8/=2(/4ZdzKD%K%%%M8@%%            
  21.    '%%%W%dGNtPK(c\/2\[Z(ttNYZ2NZW8W8K%%%%YKM%M%%.           
  22.      *%%W%GW5@/%!e]_tZdY()v)ZXMZW%W%%%*5Y]K%ZK%8[           
  23.       '*%%%%8%8WK\)[/ZmZ/Zi]!/M%%%%@f\ \Y/NNMK%%!           
  24.         'VM%%%%W%WN5Z/Gt5/b)((cV@f`  - |cZbMKW%%|           
  25.            'V*M%%%WZ/ZG\t5((+)L\'-,,/  -)X(NWW%%            
  26.                 `~`MZ/DZGNZG5(((\,    ,t\\Z)KW%@            
  27.                    'M8K%8GN8\5(5///]i!v\K)85W%%f            
  28.                      YWWKKKKWZ8G54X/GGMeK@WM8%@             
  29.                       !M8%8%48WG@KWYbW%WWW%%%@              
  30.                         VM%WKWK%8K%%8WWWW%%%@`              
  31.                           ~*%%%%%%W%%%%%%%@~                
  32.                              ~*MM%%%%%%@f`                  
  33.                                  ''''

注释 50

  1. /************************************************************ 
  2.         *                                                           * 
  3.         *  .=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-.       * 
  4.         *   |                     ______                     |      * 
  5.         *   |                  .-"      "-.                  |      * 
  6.         *   |                 /            \                 |      * 
  7.         *   |     _          |              |          _     |      * 
  8.         *   |    ( \         |,  .-.  .-.  ,|         / )    |      * 
  9.         *   |     > "=._     | )(__/  \__)( |     _.=" <     |      * 
  10.         *   |    (_/"=._"=._ |/     /\     \| _.="_.="\_)    |      * 
  11.         *   |           "=._"(_     ^^     _)"_.="           |      * 
  12.         *   |               "=\__|IIIIII|__/="               |      * 
  13.         *   |              _.="| \IIIIII/ |"=._              |      * 
  14.         *   |    _     _.="_.="\          /"=._"=._     _    |      * 
  15.         *   |   ( \_.="_.="     `--------`     "=._"=._/ )   |      * 
  16.         *   |    > _.="                            "=._ <    |      * 
  17.         *   |   (_/                                    \_)   |      * 
  18.         *   |                                                |      * 
  19.         *   '-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-='      * 
  20.         *                                                           * 
  21.         *      LASCIATE OGNI SPERANZA, VOI CH'ENTRATE               *              LEAVE EVERY HOPE, YOU COME IN 
  22.         *************************************************************/ 

注释 51

  1. /**** 原文 *****/ 
  2. // This was clearly written under duress 
  3.  
  4. /**** 自译 *****/ 
  5. // 如果将来我读到这篇文章,我会回到过去并自杀。 

注释 52

  1. /**** 原文 *****/ 
  2. // This was clearly written under duress 
  3.  
  4. /**** 自译 *****/ 
  5. // 乱七八糟的 SQL语句,但它有效,所以请不要触摸它 

注释 53

  1. //        .==.        .==.           
  2. //       //`^\\      //^`\\          
  3. //      // ^ ^\(\__/)/^ ^^\\         
  4. //     //^ ^^ ^/6  6\ ^^ ^ \\        
  5. //    //^ ^^ ^/( .. )\^ ^ ^ \\       
  6. //   // ^^ ^/\| v""v |/\^ ^ ^\\      
  7. //  // ^^/\/ /  `~~`  \ \/\^ ^\\     
  8. //  ----------------------------- 
  9. /// 这是条龙 

注释54

  1. /**** 原文 *****/ 
  2. // I from the future read this I'll back in time and kill myself. 
  3.  
  4. /**** 自译 *****/ 
  5. // 这是垃圾代码,但现在是凌晨3点,我需要把它修好。 

注释55

  1. // 我不确定我做了什么 

注释56

  1. 如果你想被解雇,请将其删除 

注释 57

  1. // 切勿动以下代码,否则我会踢你的 PP 

作者:xor 译者:前端小智 来源:medium 原文:https://medium.com/javascript-in-plain-english/30-funny-code-comments-that-will-make-you-laugh-1c1b54d4ab00

本文转载自微信公众号「大迁世界」,可以通过以下二维码关注。转载本文请联系大迁世界公众号。

 

责任编辑:武晓燕 来源: 大迁世界
相关推荐

2019-10-10 16:49:18

Python镜音双子脚本语言

2020-06-12 08:21:58

JavaScript代码开发

2019-10-11 09:07:46

Java代码对象

2016-10-25 14:42:52

白宫开源机器人代码

2021-05-26 11:50:37

代码优化Java

2020-04-26 10:01:14

编程学习技术

2012-07-13 09:35:58

PHP

2012-07-13 09:38:15

项目代码

2015-07-29 13:22:40

.NET代码

2017-10-23 12:42:42

2022-06-06 12:02:23

代码注释语言

2012-07-19 10:42:17

项目

2011-10-31 14:53:23

Dart

2018-08-24 21:25:02

编程语言代码重构GitHub

2018-03-29 14:51:59

智能公厕AI

2018-04-26 11:12:06

OracleNetSuite电子商务

2018-04-27 16:17:55

网店企业NetSuite

2014-11-26 14:46:47

代码

2020-08-26 08:09:21

厕所物联网IOT

2009-12-04 09:51:32

VS XML注释
点赞
收藏

51CTO技术栈公众号