Barr Group TwitterBarr Group Vimeo

Conformance with all of the rules in this coding standard is deemed mandatory. Non-conforming code should preferably be detected: primarily via automated scans (i.e., static analysis); secondarily via peer code reviews; or, in the absence of those options, informal discovery. Upon detection, any non-conforming code should be made to meet all of the rules herein.

There are commercial static analysis tools that can be used to automatically check for non-compliance with many of the rules of this and other coding standards. Tools pre-configured to detect violations of the enforceable subset of rules in this coding standard are requested to refer to it as the “BARR-C:2018” standard.

When changing to a new coding standard, decisions must be made regarding legacy code. Few development teams have time to revisit the style of pre-existing source code libraries.

With respect to legacy code we suggest that:

  • It is generally best to leave working legacy code alone. Unless, of course, life and limb are on the line.

  • Any decision to bring legacy source code into conformance with the rules herein should be made for one module (i.e., .h header file and .c source file) or library at a time. The best time to make such stylistic changes is often when the module or library also requires functional changes.

Note that changes relating to the use and/or placement of white space (e.g., replacement of tabs with spaces) should be made in a version control check-in that is distinct from functional changes to the same code. This is to ensure the maximal utility of the source code differencing features of version control tools with respect to functional changes made before and after the white space changes.

 

Comments:

Detailed instructions for using LDRArules and PC-Lint/FlexeLint to enforce specific rules, including configuration settings and template option files, can be found in the following blog posts:

What’s happening and how it’s done. Get in the know.

Sign Up for Our Newsletter

Receive free how-to articles, industry news, and the latest info on Barr Group webinars and training courses via email. 

To prevent automated spam submissions leave this field empty.