The GNU Coding Standards were written by Richard Stallman and other GNU Project volunteers. Their purpose is to make the GNU system clean, consistent, and easy to install. This document can also be read as a guide to writing portable, robust and reliable programs. It focuses on programs written in C, but many of the rules and principles are useful even if you write in another programming language. The rules often state reasons for writing in a certain way.
If you did not obtain this file directly from the GNU project and recently, please check for a newer version. You can get the GNU Coding Standards from the GNU web server in many different formats, including the Texinfo source, PDF, HTML, DVI, plain text, and more, at: https://www.gnu.org/prep/standards/.
If you are maintaining an official GNU package, in addition to this document, please read and follow the GNU maintainer information (see Contents in Information for Maintainers of GNU Software).
If you want to receive diffs for every change to these GNU documents,
join the mailing list
firstname.lastname@example.org, via the web
Archives are also available there.
Please send corrections or suggestions for this document to email@example.com. If you make a suggestion, please include a suggested new wording for it, to help us consider the suggestion efficiently. We prefer a context diff to the Texinfo source, but if that’s difficult for you, you can make a context diff for some other version of this document, or propose it in any way that makes it clear. The source repository for this document can be found at https://savannah.gnu.org/projects/gnustandards.
These standards cover the minimum of what is important when writing a GNU package. Likely, the need for additional standards will come up. Sometimes, you might suggest that such standards be added to this document. If you think your standards would be generally useful, please do suggest them.
You should also set standards for your package on many questions not addressed or not firmly specified here. The most important point is to be self-consistent—try to stick to the conventions you pick, and try to document them as much as possible. That way, your program will be more maintainable by others.
The GNU Hello program serves as an example of how to follow the GNU coding standards for a trivial program. https://www.gnu.org/software/hello/hello.html.
This release of the GNU Coding Standards was last updated June 12, 2020.