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


当前回答

public static final void attachListener(Object listener) {

/* ======================= */

// This does nothing, continue searching

/* ======================= */

...

与听众一起痛苦!

其他回答

// I have to find a better job

这个我在Python 2.5的“twisted”包中找到的(文件是tcp.py在第371行)

# Limit length of buffer to try to send, because some OSes are too
# stupid to do so themselves (ahem windows)
return self.socket.send(buffer(data, 0, self.SEND_LIMIT))

在LucasArts的电脑游戏《the Eidolon》(游戏邦注:这款游戏本身就很古怪)的源代码中可以看到……

// He's dead, Jim!
// fix for groupid > 9 
// if groupid ever gets to 100 everything will break (again)

if (groupid < 10) {
groupid = "0" + groupid;
}
struct core_unlocker
{
    core_unlocker(lock)
    {
        m_lock = lock
        unlock(lock)  //Abandon All Locks, Ye Who Enter Core!
    }
    ~core_unlocker()
    {
        lock(m_lock)
    }  
    private:
    Corelock m_lock;
}