Coding Style

It is a profoundly erroneous truism, repeated by all copy-books and by eminent people when they are making speeches, that we should cultivate the habit of thinking of what we are doing. The precise opposite is the case. Civilisation advances by extending the number of operations we can perform without thinking about them.

— Alfred North Whitehead, Introduction to Mathematics

Anyone who found their way to this page is probably already familiar with all the arguments in favor of a consistent coding style, so I won't repeat them here (apart from some editorial commentary in the introductory quote). I've gone through multiple coding styles over the years and have landed on the ones documented on this page. I try to keep all of my software consistent with these style documents. There are a few exceptions, but I try to reduce or eliminate them over time.

These coding styles were also used by most software developed by the Infrastructure Delivery Group at Stanford University when I left in 2014.

For examples of these coding styles at work, see my software, paying particular attention to the packages that have been released the most recently. rra-c-util collects portability glue and utility code for packages that use C, Autoconf, and Automake, in part to help with implementing these standards.

Style guides for packaging:

Style guides for programming languages:

Last spun 2022-02-06 from thread modified 2015-11-01