Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update of coding guidelines for cpp #1250

Closed
sandro-elsweijer opened this issue Sep 24, 2024 · 0 comments
Closed

Update of coding guidelines for cpp #1250

sandro-elsweijer opened this issue Sep 24, 2024 · 0 comments
Assignees
Labels
C++ discussion priority: medium Should be solved within half a year workload: medium Would take a week or less

Comments

@sandro-elsweijer
Copy link
Collaborator

sandro-elsweijer commented Sep 24, 2024

Currently, our coding guidelines only describe function and class/struct naming conventions and we need to adapt these to all other cpp types like template parameters and member functions.

I propose the following conventions, which are also used in Boost and the STL. These would mean minimal changes to our code and the snake_case would allow our spell checker work properly. CamelCase and pascalCase often do not work with spell checkers.

  • structs/classes/free functions: t8_snake_case with t8 prefix (t8_forest_..., t8_geometry_...)
  • member functions and member variables: snake_case without t8 prefix (the t8 prefix is already in the class name)
  • Template parameters: TCamelCase with leading T for template

Furthermore, we should think about the _t in our typedefs, since it is reserved for POSIX.

Alternatively, we could also completely remove the t8 prefixes and introduce namespaces, but this would be a bigger change.

The longer we wait, the more we have to change.

Edit:
I stmbled upon some functions, which do this: returnType t8_some_function(void); From my short research this is the way to go, but we do not do this consistently. Should we adapt it to all other functions which have no arguments?

@sandro-elsweijer sandro-elsweijer added discussion C++ priority: medium Should be solved within half a year workload: medium Would take a week or less labels Sep 24, 2024
@sandro-elsweijer sandro-elsweijer changed the title Update of conding guidelines for cpp code Update of coding guidelines for cpp Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C++ discussion priority: medium Should be solved within half a year workload: medium Would take a week or less
Projects
None yet
Development

No branches or pull requests

3 participants