你遇到过的源代码中最好的注释是什么?


当前回答

好吧,这些是我的,所以WTF是我,正如CodingHorror所说:

//#region Code for weird cases - do you really want to know?

我曾经在一些ASP中留下了这样的评论:

' Commented out following code, don't delete for when [CustomerName] changes his mind

碰巧,[CustomerName]没有改变他的想法,但他确实有访问web服务器,他确实找到了那行…

其他回答

试着在谷歌代码搜索中输入你最喜欢的脏话,它会消磨掉许多无聊的时间。以下是我最喜欢的例子:

/* These magic numbers are fucking stupid. */

/* Dear free software world, do you NOW see we are fucking
   things up?! This is insane! */

/* 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. */

# However, this only works if there are MULTIPLE checkboxes!
# The fucking JS DOM *changes* based on one or multiple boxes!?!?!
# Damn damn damn I hate the JavaScript DOM so damn much!!!!!!

/* TODO: this is obviously not right ... this whole fucking module
   sucks anyway */

/* FIXME: please god, when will the hurting stop? Thus function is so
   fucking broken it's not even funny. */

我个人最喜欢的

 # code below replaces code above - any problems?
 # yeah, it doesn't fucking work.
/**
 * This run through all the guipublisherbuyRecord , the records those have
 * diff. is buytotal and prior to buy isRecommendedBillingClickedWarning flag
 * is set if priously RB ran and this time not.
 * 
 * --What?
 * 
 * @return
 * @throws AppException
 */
// This is a walkaround for bug #7812

是我们的一个中国程序员写的,他的第一语言不是英语。

我真的很喜欢这个。我碰巧认为“walkaround”几乎比“workaround”更好。

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  .__  _.-\   \
  ##         | |  |  ``/  /`  /
  ##        /,_|  |   /,_/   /
  ##           /,_/      '`-'
  ## 

不记得我在哪里见过这些了

long time; /* know C */

and(在代码中创建某种UNIX守护进程):

/* Be a real daemon: fork myself and kill my parent */