新聞中心
代碼注釋,有些人說它太丑,也有些人說它是標(biāo)準(zhǔn)和良好的做法。在本文中, 列出了一些在編程中遇到的有趣的代碼注釋。

創(chuàng)新互聯(lián)堅持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:網(wǎng)站設(shè)計、成都網(wǎng)站制作、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時代的武鄉(xiāng)網(wǎng)站設(shè)計、移動媒體設(shè)計的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!
注釋 1
- // Weed Effect !
- 這是雜草效應(yīng)的意思?不是很懂,有誰知道,可以留言一下。
注釋 2
- /**** 原文 *****/
- //The following code was written by
. - // Unless it doesn't work, then I have no idea who wrote it.
- /**** 自譯 *****/
- // 以下代碼是由
編寫的。 - // 除非它不起作用,否則我不知道是誰寫的。
注釋 3
- /**** 原文 *****/
- // Ad Index scheming and plotting - Those with
- // heart conditions are advised to not continue
- /**** 自譯 *****/
- // 廣告索引的設(shè)計和繪圖模塊
- // 建議不要深入閱讀,否則容得得心臟病
注釋 4
- /**** 原文 *****/
- // nobody read comments!
- /**** 自譯 *****/
- // 沒人會讀的注釋
注釋 5
- /**** 原文 *****/
- i++; // increment i
- /**** 自譯 *****/
- i++; // 自增 i
注釋 6
- /**** 原文 *****/
- // Magic. Do not touch.
- /**** 自譯 *****/
- // 這里已經(jīng)結(jié)界,不要碰.
注釋 7
- /**** 原文 *****/
- // sometimes I believe compiler ignores all my comments
- /**** 自譯 *****/
- // 有時我相信編譯器會忽略我的所有注釋
注釋 8
- /**** 原文 *****/
- // I am not responsible of this code.
- // They made me write it, against my will.
- /**** 自譯 *****/
- // 我對此代碼不承擔(dān)任何責(zé)任。
- // 是他們強(qiáng)迫我讓我寫的,這已違背了我的意愿。
注釋 9
- /**** 原文 *****/
- //
- // 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
- /**** 自譯 *****/
- // 親愛的程序媛
- //
- // 一旦你嘗試“優(yōu)化”此代碼,并意識到這是一個可怕的錯誤,
- // 請增加以下計數(shù)器,以警告下一個人
- // total_hours_wasted_here = 42
注釋 10
- /**** 原文 *****/
- # To understand recursion, see the bottom of this file
- At the bottom of the file
- # To understand recursion, see the top of this file
- /**** 自譯 *****/
- # 要了解遞歸,請參見此文件的底部
- 在文件的底部
- # 要了解遞歸,請參見此文件的頂部
注釋 11
- /**** 原文 *****/
- // I will give you two of my seventy-two virgins if you can fix this.
- /**** 自譯 *****/
- // 如果你能解決這個問題,我就把我七十二個處女中的兩個給你。
注釋 12
- /**** 原文 *****/
- //Dear future me. Please forgive me.
- //I can't even begin to express how sorry I am.
- /**** 自譯 *****/
- // 你好,未來帥氣的我,請原諒我。
- // 我現(xiàn)在無法表達(dá)我的歉意,因為我寫下了這段代碼。
注釋 13
- /**** 原文 *****/
- //private instance variable for storing age
- public static int age;
- /**** 自譯 *****/
- // 用于存儲年齡的私有實例變量
- public static int age;
注釋 14
- /**** 原文 *****/
- const int TEN=10; // s if the value of 10 will fluctuate...
- /**** 自譯 *****/
- const int TEN=10; // 10 是會改變的值
注釋 15
- /**** 原文 *****/
- /* You are not meant to understand this */
- /**** 自譯 *****/
- /* 你不應(yīng)該理解這一點(diǎn) */
注釋 16
- /**** 原文 *****/
- /*
- * TODO: Remove this function
- function remove($customer_id)
- {
- $this->Customer->remove($id);
- }
- */
- /**** 自譯 *****/
- /*
- * TODO: 刪除函數(shù)
- function remove($customer_id)
- {
- $this->Customer->remove($id);
- }
- */
注釋 17
- /**** 原文 *****/
- //When I wrote this, only God and I understood what I was doing
- //Now, God only knows
- /**** 自譯 *****/
- // 當(dāng)我寫這段代碼,只有上帝和我知道這是在做什么
- ...
- // 現(xiàn)在,只有上帝知道這段代碼在做什么
注釋 18
- /**** 原文 *****/
- // drunk, fix later
- /**** 自譯 *****/
- // 喝醉了,待會解決
注釋 19
- /**** 原文 *****/
- // I'm sorry.
- /**** 自譯 *****/
- // 我很抱歉
注釋 20
- /**** 原文 *****/
- // I am not responsible of this code.
- /**** 自譯 *****/
- // 我對此代碼不承擔(dān)任何責(zé)任。
注釋 21
- /**** 原文 *****/
- // I have to find a better job
- /**** 自譯 *****/
- // 我必須找到更好的工作
注釋 22
- /**** 原文 *****/
- // Joe is sorry
- A few hundred lines later...
- // Harry is sorry too
- /**** 自譯 *****/
- // 老五抱歉了
- 寫了幾百行代碼之后...
- // 小五對不住了
注釋 23
- /**** 原文 *****/
- # Christmas tree initializer
- toConnect = []
- toRead = [ ]
- toWrite = [ ]
- primes = [ ]
- responses = {}
- remaining = {}
- /**** 自譯 *****/
- # 圣誕樹初始化器
- toConnect = []
- toRead = [ ]
- toWrite = [ ]
- primes = [ ]
- responses = {}
- remaining = {}
注釋 24
- /**** 原文 *****/
- Catch (Exception e) {
- // who cares?
- }
- /**** 自譯 *****/
- Catch (Exception e) {
- // 管它呢?
- }
注釋 25
- /**** 原文 *****/
- // IE7 update. this is still bad code, but IE8 is probably a long way off :)
- /**** 自譯 *****/
- IE7更新,這仍然是錯誤的代碼,看來 IE8 還有很長的路要走:)
注釋 26
- /**** 原文 *****/
- // If this code works, it was written by Paul DiLascia. If not, I don't know
- /**** 自譯 *****/
- // 如果這個代碼有效的話,它就是由 前端小智 編寫的。如果出錯了,我也不知道是誰寫的。
注釋 27
- /**** 原文 *****/
- // This comment is self explanatory.
- /**** 自譯 *****/
- // 這個注釋不言自明。
注釋 28
- /**** 原文 *****/
- int main(void)
- /* Program starts here */
- /**** 自譯 *****/
- int main(void)
- /* 程序從這里開始 */
注釋 29
- /**** 原文 *****/
- // I am not sure if we need this, but too scared to delete.
- /**** 自譯 *****/
- // 我不確定我們是否需要這個,但又害怕刪除
注釋 30
- /**** 原文 *****/
- /**
- * Always returns true.
- */
- public boolean isAvailable() {
- return false;
- }
- /**** 自譯 *****/
- /**
- * 總是返回 true.
- */
- public boolean isAvailable() {
- return false;
- }
注釋 31
- /**** 原文 *****/
- // Autogenerated, do not edit. All changes will be undone.
- /**** 自譯 *****/
- // 自動生成,不要編輯。所有的更改都將被撤銷。
注釋 32
- /**** 原文 *****/
- // hack for ie browser (assuming that ie is a browser)
- /**** 自譯 *****/
- // 破解ie瀏覽器(假設(shè)ie是一個瀏覽器)
注釋 33
- /**** 原文 *****/
- /////////////////////////////////////// this is a well commented line
- /**** 自譯 *****/
- /////////////////////////////////////// 這是一個很好的注釋
注釋 34
- /**** 原文 *****/
- // Mr. Compiler, please do not read this.
- /**** 自譯 *****/
- // 編譯先生,請不要讀取這個
注釋 35
- /**** 原文 *****/
- // All bugs added by David S. Miller
- /**** 自譯 *****/
- // 所有 bug 都是由 老王 添加的
注釋 36
- /**** 原文 *****/
- //If you're reading this, then my program is probably a success
- /**** 自譯 *****/
- // 如果你現(xiàn)在在認(rèn)真詳細(xì)的閱讀這段代碼,那么寫的這段代碼應(yīng)該是沒有問題的。
注釋 37
- /**** 原文 *****/
- Catch (Exception e) {
- //eat it
- }
- /**** 自譯 *****/
- Catch (Exception e) {
- // 吃掉它
- }
注釋 38
- /**** 原文 *****/
- //todo: never to be implemented
- /**** 自譯 *****/
- // todo:永遠(yuǎn)不會執(zhí)行
注釋 39
- /**** 原文 *****/
- // simply copied from another code
- /**** 自譯 *****/
- // 別問,問我也是從另一個代碼拷貝過來的
注釋 40
- /**** 原文 *****/
- //Please comment on your source code
- /**** 自譯 *****/
- // 拜托啦,請把你寫的代碼注釋一下
注釋 41
- /**** 原文 *****/
- # as you can see: I comment the code!
- /**** 自譯 *****/
- # 如你所見:我注釋了代碼!
注釋 42
- /**** 原文 *****/
- // if i ever see this again i'm going to start bringing guns to work
- /**** 自譯 *****/
- // 如果我再看到這個,我會帶槍去工作
注釋 43
- def format_ticket_content(text, recursive = true)
- if text.is_a?(TicketNote)
- note = text
- text = note.content
- else
- note = nil
- end
- ## Safety pig has arrived!
- text = h(text)
- ## _
- ## _._ _..._ .-', _.._(`))
- ## '-. ` ' /-._.-' ',/
- ## ) \ '.
- ## / _ _ | \
- ## | a a / |
- ## \ .-. ;
- ## '-('' ).-' ,' ;
- ## '-; | .'
- ## \ \ /
- ## | 7 .__ _.-\ \
- ## | | | ``/ /` /
- ## /,_| | /,_/ /
- ## /,_/ '`-'
- ##
注釋 44
- /**** 原文 *****/
- long long ago; /* in a galaxy far far away */
- /**** 自譯 *****/
- long long ago; /* 在遙遠(yuǎn)的星系中 */
注釋 45
- /**** 原文 *****/
- try {
- } finally { // should never happen
- }
- /**** 自譯 *****/
- try {
- } finally { // 這里永遠(yuǎn)不會被執(zhí)行
- }
注釋 46
- /**** 原文 *****/
- /* Ah ah ah! You'll never understand why this one works. */
- /**** 自譯 *****/
- // 啊啊??!你永遠(yuǎn)都不會明白為什么這個方法有效。
注釋 47
- /**** 原文 *****/
- // this formula is right, work out the math yourself if you don't believe me
- /**** 自譯 *****/
- // 這個公式是正確的,如果你不相信我,自己動手算一下
注釋 48
- /**** 原文 *****/
- // This was clearly written under duress
- /**** 自譯 *****/
- // 這顯然是在脅迫下寫的
注釋 49
- .=' ' .`/,/!(=)Zm.
- .._,,._.. ,-`- `,\ ` -` -`\\7//WW.
- ,v=~/.-,-\- -!|V-s.)iT-|s|\-.' `///mK%.
- v!`i!-.e]-g`bT/i(/[=.Z/m)K(YNYi.. /-]i44M.
- v`/,`|v]-DvLcfZ/eV/iDLN\D/ZK@%8W[Z.. `/d!Z8m
- //,c\(2(X/NYNY8]ZZ/bZd\()/\7WY%WKKW) -'|(][%4.
- ,\\i\c(e)WX@WKKZKDKWMZ8(b5/ZK8]Z7%ffVM, -.Y!bNMi
- /-iit5N)KWG%%8%%%%W8%ZWM(8YZvD)XN(@. [ \]!/GXW[
- / ))G8\NMN%W%%%%%%%%%%8KK@WZKYK*ZG5KMi,- vi[NZGM[
- i\!(44Y8K%8%%%**~YZYZ@%%%%%4KWZ/PKN)ZDZ7 c=//WZK%!
- ,\v\YtMZW8W%%f`,`.t/bNZZK%%W%%ZXb*K(K5DZ -c\\/KM48
- -|c5PbM4DDW%f v./c\[tMY8W%PMW%D@KW)Gbf -/(=ZZKM8[
- 2(N8YXWK85@K -'c|K4/KKK%@ V%@@WD8e~ .//ct)8ZK%8`
- =)b%]Nd)@KM[ !'\cG!iWYK%%| !M@KZf -c\))ZDKW%`
- YYKWZGNM4/Pb '-VscP4]b@W% 'Mf` -L\///KM(%W!
- !KKW4ZK/W7)Z. '/cttbY)DKW% -` .',\v)K(5KW%%f
- 'W)KWKZZg)Z2/,!/L(-DYYb54% ,,`, -\-/v(((KK5WW%f
- \M4NDDKZZ(e!/\7vNTtZd)8\Mi!\-,-/i-v((tKNGN%W%%
- 'M8M88(Zd))///((|D\tDY\\KK-`/-i(=)KtNNN@W%%%@%[
- !8%@KW5KKN4///s(\Pd!ROBY8/=2(/4ZdzKD%K%%%M8@%%
- '%%%W%dGNtPK(c\/2\[Z(ttNYZ2NZW8W8K%%%%YKM%M%%.
- *%%W%GW5@/%!e]_tZdY()v)ZXMZW%W%%%*5Y]K%ZK%8[
- '*%%%%8%8WK\)[/ZmZ/Zi]!/M%%%%@f\ \Y/NNMK%%!
- 'VM%%%%W%WN5Z/Gt5/b)((cV@f` - |cZbMKW%%|
- 'V*M%%%WZ/ZG\t5((+)L\'-,,/ -)X(NWW%%
- `~`MZ/DZGNZG5(((\, ,t\\Z)KW%@
- 'M8K%8GN8\5(5///]i!v\K)85W%%f
- YWWKKKKWZ8G54X/GGMeK@WM8%@
- !M8%8%48WG@KWYbW%WWW%%%@
- VM%WKWK%8K%%8WWWW%%%@`
- ~*%%%%%%W%%%%%%%@~
- ~*MM%%%%%%@f`
- '''''
注釋 50
- /************************************************************
- * *
- * .=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-. *
- * | ______ | *
- * | .-" "-. | *
- * | / \ | *
- * | _ | | _ | *
- * | ( \ |, .-. .-. ,| / ) | *
- * | > "=._ | )(__/ \__)( | _.=" < | *
- * | (_/"=._"=._ |/ /\ \| _.="_.="\_) | *
- * | "=._"(_ ^^ _)"_.=" | *
- * | "=\__|IIIIII|__/=" | *
- * | _.="| \IIIIII/ |"=._ | *
- * | _ _.="_.="\ /"=._"=._ _ | *
- * | ( \_.="_.=" `--------` "=._"=._/ ) | *
- * | > _.=" "=._ < | *
- * | (_/ \_) | *
- * | | *
- * '-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=' *
- * *
- * LASCIATE OGNI SPERANZA, VOI CH'ENTRATE * LEAVE EVERY HOPE, YOU COME IN
- *************************************************************/
注釋 51
- /**** 原文 *****/
- // This was clearly written under duress
- /**** 自譯 *****/
- // 如果將來我讀到這篇文章,我會回到過去并自殺。
注釋 52
- /**** 原文 *****/
- // This was clearly written under duress
- /**** 自譯 *****/
- // 亂七八糟的 SQL語句,但它有效,所以請不要觸摸它
注釋 53
- // .==. .==.
- // //`^\\ //^`\\
- // // ^ ^\(\__/)/^ ^^\\
- // //^ ^^ ^/6 6\ ^^ ^ \\
- // //^ ^^ ^/( .. )\^ ^ ^ \\
- // // ^^ ^/\| v""v |/\^ ^ ^\\
- // // ^^/\/ / `~~` \ \/\^ ^\\
- // -----------------------------
- /// 這是條龍
注釋54
- /**** 原文 *****/
- // I from the future read this I'll back in time and kill myself.
- /**** 自譯 *****/
- // 這是垃圾代碼,但現(xiàn)在是凌晨3點(diǎn),我需要把它修好。
注釋55
- // 我不確定我做了什么
注釋56
- 如果你想被解雇,請將其刪除
注釋 57
- // 切勿動以下代碼,否則我會踢你的 PP
作者:xor 譯者:前端小智 來源:medium 原文:https://medium.com/javascript-in-plain-english/30-funny-code-comments-that-will-make-you-laugh-1c1b54d4ab00
本文轉(zhuǎn)載自微信公眾號「大遷世界」,可以通過以下二維碼關(guān)注。轉(zhuǎn)載本文請聯(lián)系大遷世界公眾號。
網(wǎng)頁題目:30 多個有內(nèi)味道且笑死的人代碼注釋
網(wǎng)站鏈接:http://www.fisionsoft.com.cn/article/dphiped.html


咨詢
建站咨詢
