Ticket #697 (new wishlist)

Opened 6 months ago

Create/publish C coding style standards

Reported by: alexander Owned by: somebody
Priority: major Milestone:
Component: ALL modules Version:
Keywords: Cc:

Description

After a couple of years of going through Earthworm source code, I want to bring up a major issue I have with the quality of the code.

C coding styles vary wildly from file to file, often making it difficult to understand what is going on. Sometimes, this can be as simple as a lack of a consistent tabbing style (sometimes indents are equivalent to 2 spaces, sometimes 3, and sometimes 4). Often, blocks will not be indented to their logical level, with inner blocks on the same level as their outer conditions.

Bracket conventions are often non-existent/haphazard, in particular in those situations where statements are not enclosed by the conditions they are subject to.

This "wishlist" item might be accomplished by the following:

1) Declaring the code practices that one wishes to follow, starting with the above and possibly including other guidelines on whitespace, naming conventions, commenting, the use of goto, etc.

2) Defining a scope the above conventions should apply to, probably at least covering earthworm's code functions and listing some guidelines for applying to standard modules.

3) Publishing the guidelines for the EW developer community, ideally having solicited feedback from said community beforehand.

As a jumping off point, I'll leave some links where a few communities and projects have published their own guidelines. These are not all consistent with each other, but in each case there is a standard which is articulated and some discussion as to why certain decisions were made.

Rob Pike "Notes on Programming in C" http://doc.cat-v.org/bell_labs/pikestyle

Linux kernel coding style: https://www.kernel.org/doc/Documentation/process/coding-style.rst

OpenBSD coding style: https://man.openbsd.org/style

Note: See TracTickets for help on using tickets.