Generally, Rialto project shall follow the google style guidelines https://google.github.io/styleguide/cppguide.html.
| Category | Google Rule | Rialto Rule | Reason |
|---|---|---|---|
| Include guards | Include guard format: <PROJECT>_<PATH>_<FILE>_H_. | TBD | |
| Filenames | Filenames should be all lowercase and can include underscores (_) or dashes (-). | Filenames should capitalise all words with no underscores (PascalCase / UpperCamelCase). E.g. RialtoClientLogging.h | Common Sky AI format. |
| Variable names | The names of variables (including function parameters) and data members are all lowercase, with underscores between words. | Variable names should contain no underscores and begin with a lowercase word, any subsequent words should be capitalised (mixedCase / lowerCamelCase). E.g. mediaPlayer | Common Sky AI format. |
| Data member names | Data members of classes, both static and non-static, are named like ordinary nonmember variables, but with a trailing underscore. | Treat them the same as variables but with a prefixed 'm_'. E.g. m_mediaPlayer | Common Sky AI format. |
| Function names | Regular functions have PascalCase; accessors and mutators may be named like variables. | Function names should contain no underscores and begin with a lowercase word, any subsequent words should be capitalised (mixedCase / lowerCamelCase). E.g. removeSource() | Common Sky AI format. |
| Namespace names | Names are all lower-case, with words separated by underscores. | Namespace names should be all lowercase with no underscores. E.g. servermanager | Common Sky AI format. |
| C++ Exceptions | Do not use C++ exceptions. | Exceptions are allowed in constructors as long as the class has an associated factory to catch the exceptions. | Google not using exceptions is an internal decision based on older repositories. |
| TODO Comments | TODOs should include the string TODO in all caps, followed by the name, e-mail address, bug ID. | TODOs should include TODO in all caps followed by the relevant Jira Id. E.g. TODO (LLDEV-23451) | Same as google but with our own identifier. |
| Line length | Each line of text in your code should be at most 80 characters long. | A line of text should not be more than 120 characters long. | 80 too small. |
| Open curly braces | The open curly brace is always on the end of the last line of the function declaration, not the start of the next line. | Open curly braces should always be on a new line. | Common Sky AI format. |
| Access specifier indent | Access specifiers should be indented by 1 space. | Access specifiers should not be indented. | Common Sky AI format. |
| #include format | Include the directory when naming header files. | Only the filename is included in the #include unless required for 3rd party. | The way our CMake files compile the code mean that we should just use the filenames. |
| non-const reference | non-const references should not exist for output variables, instead use pointers. | non-const references are allowed. | Only enforced for readability, common Sky AI format. |
| static/global strings | For a static/global string constant, use a C style string instead. | Allow string constant. | Only enforced for memory saving, common Sky AI format. |