Coding standards » History » Revision 9
- Table of contents
- Osmocom coding standards
- Coding Style
Osmocom coding standards¶
In general, for the C-language projects we maintain in the Osmocom project, we follow the coding style
of the Linux kenrel. See https://www.kernel.org/doc/Documentation/CodingStyle for further information.
We will not debate about the coding style and whether some other style is better or worse. The important factor is not so much which coding style is followed, as long as there is one well-defined coding style and that all developers adhere to it.
For submitting patches, the best practises established by the Linux kernel development community should be followed, whenever applicable. See https://www.kernel.org/doc/Documentation/SubmittingPatches for further information.
The generally important topics are:
Submit patches against a current source tree¶
At time of submission, our patches should be based on current
master branch of the respective project, or another (more current) feature branch of that repository.
Use unified diff format¶
It's best to let git generate the patches, so you don't have to worry about that.
Have meaningful descriptions in your patches¶
Every commit/patch should have an explanation in the commit message.
Separate your changes¶
Separate each logical change into a separate patch.
Respond to review comments¶
Include PATCH in the subject¶
Rules of thumb¶Some general rules of thumb:
- Consider using tools like
universalindentguibefore submitting code
make distcheckon each of your commits to ensure the build
git imap-sendto send your patches (otherwise your mail client may wrap around lines and corrupt your patch)