newsched icon indicating copy to clipboard operation
newsched copied to clipboard

Changes to coding standard for 4.0

Open mormj opened this issue 2 years ago • 4 comments

Please add comments in this thread that should be changed as part of the coding standard.

mormj avatar Mar 10 '22 21:03 mormj

Enums

Enums should use enum class The names of enumerations should be lower case, and not require GR_ or _TYPE because of the scoping of the enum class Enum identifiers should be suffixed with `_type' Specify data type for the enum only if necessary Starting values should not be necessary

example:

enum class waveform_type {
sin,
cos,
triangle,
sawtooth
};

mormj avatar Mar 10 '22 21:03 mormj

if/else brackets

modify the .clang-format file so that should look like

if {
   // code
}
else {
 // more code
}

(in GR3 it is)

if {
  // code
} else {
  // more code
}

mormj avatar Mar 10 '22 21:03 mormj

using x = instead of typedef

mormj avatar Mar 17 '22 18:03 mormj

initialize variables in preference order:

  • class definition
  • constructor initialization list
  • constructor body Prefer brace initialization

mormj avatar Mar 17 '22 18:03 mormj