Skip to content
This repository was archived by the owner on Mar 16, 2020. It is now read-only.

Code style

lucansky edited this page Sep 15, 2014 · 2 revisions

Comments

NEVER try to explain HOW your code works in a comment: it's much better to write the code so that the working is obvious, and it's a waste of time to explain badly written code.

Generally, you want your comments to tell WHAT your code does, not HOW. Also, try to avoid putting comments inside a function body: if the function is so complex that you need to separately comment parts of it, you should probably go back to chapter 6 for a while. You can make small comments to note or warn about something particularly clever (or ugly), but try to avoid excess. Instead, put the comments at the head of the function, telling people what it does, and possibly WHY it does it.

https://www.kernel.org/doc/Documentation/CodingStyle

Clone this wiki locally