Info |
---|
This document was drawn from C++ Code Standards on the Trac/Wiki. There have been some light edits (including some re-formatting for Confluence). The content on this page should be verified before the Trac/Wiki pages are removed. |
Section | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...
skip-headings | h4 |
---|---|
start-numbering-with | 1 |
start-numbering-at | h2 |
Introduction
This document lists C++ coding recommendations common in the C++ development community. The recommendations are based on established standards collected from a number of sources, individual experience, local requirements/needs, as well as suggestions given in References (1 - 4).
While a given development environment (IDE) can improve the readability of code by access visibility, color coding, automatic formatting and so on, the programmer should never rely on such features. Source code should always be considered larger than the IDE it is developed within and should be written in a way that maximizes its readability independent of any IDE.
Refer to DM's Policy on Coding Style for the guiding principles regarding the stringency levels and under what circumstances you may deviate from a guideline.
Layout of the Recommendations
The recommendations are grouped by topic and each recommendation is numbered to make it easier to refer to during reviews.
Layout of the recommendations is as follows:
x.y Guideline
Short description
Motivation, background and additional information.
The motivation section is important. Coding standards and guidelines tend to start "religious wars", and it is important to state the background for the recommendation.
Recommendation Importance
In the guideline sections, the terms REQUIRED, MUST, SHOULD, amongst others, have special meaning. Refer to the stringency levels in DM's policy on Coding Style for their definitions.
DM uses the spirit of the IETF organization's RFC 2199 Reference(10) definitions.
General Recommendations
Naming Conventions
General Naming Conventions
Specific Naming Conventions
Files
Source Files
Include Files and Include Statements
Statements
Types
Variables
Loops
Conditionals
Methods and Functions
Constructors and Destructors
Miscellaneous
Layout and Comments
Layout
White Space
Comments
Legacy Code
7-1. All legacy code SHOULD have an interface definition specification that follows these rules.
This rule is primarily in the case of writing wrapper classes for legacy code. While it is not expected that we will bring the guts of all legacy code in line with the specifications in this document, it is important that public interfaces follow the rules of new code.
References
...
...
...
...
...
...
- https://science.nrao.edu/facilities/alma/aboutALMA/Technology/ALMA_Computing_Memo_Series/0009/2001-06-06.pdf
...
...