Skip to content
This repository has been archived by the owner on Jul 19, 2022. It is now read-only.

Changes to coding standard for 4.0 #203

Open
mormj opened this issue Mar 10, 2022 · 4 comments
Open

Changes to coding standard for 4.0 #203

mormj opened this issue Mar 10, 2022 · 4 comments

Comments

@mormj
Copy link
Contributor

mormj commented Mar 10, 2022

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

@mormj
Copy link
Contributor Author

mormj commented Mar 10, 2022

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
Copy link
Contributor Author

mormj commented Mar 10, 2022

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 mormj changed the title Changes to coding standard Changes to coding standard for 4.0 Mar 10, 2022
@mormj
Copy link
Contributor Author

mormj commented Mar 17, 2022

using x = instead of typedef

@mormj
Copy link
Contributor Author

mormj commented Mar 17, 2022

initialize variables in preference order:

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant