Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux綜合 >> 學習 Linux

Linus Torvalds 又槓上了,這次的理由是註解裡的標點符號

Linus Torvalds 又槓上了,這次的理由是註解裡的標點符號

Linus Torvalds 又在 Linux 內核開發者郵件列表上發火了,這回他把部分程式設計師偏愛的程式碼註解標點格式稱為「腦殘」。

他強烈反對的寫法長這樣:

/* This is disgusting drug-induced * crap, and should die */

以及:

/* This is also very nasty * and visually unbalanced */

他個人支持、也希望大家統一的格式則是:

/* This is a comment */

和

/*
 * This is also a comment, but it can now be cleanly
 * split over multiple lines
 */

爭點看起來瑣碎,但這類風格共識在大型專案裡並非小事:註解排版混亂會讓 diff 變得難讀,也會讓每個人的視線在多餘的星號上來回跳動。對一個數千名貢獻者共同維護的程式碼庫而言,把這件事講清楚,本身就是一種降低協作成本的方式。

Copyright © Linux教程網 All Rights Reserved