RidgeRun Developer Manual - Coding Styles - C++

From RidgeRun Developer Connection
< RidgeRun Developer Manual‎ | Coding Styles
Revision as of 13:19, 21 December 2020 by Lleon (talk | contribs) (Fix the NULL to avoid hard typing ambiguities)
Jump to: navigation, search




Previous: Coding Styles/C Index Next: Coding Styles/Python




Introduction to 'C++' Coding Styles

When writing software source code there are many coding styles as the concept covers a lot of aspects (some of them subjective). In general RidgeRun tries to follow the Google C++ Style Guide.

Other good practices

Conditionals

if ( nullptr == var ) {
  // ...
}

This is to avoid possible bugs like:

if ( var = nullptr ) {
  // ...
}

A derived good practice is to use const keyword as much as you can:

const int val = 1;

if (val = 2) { // This should not compile
    ...
}


Previous: Coding Styles/C Index Next: Coding Styles/Python