dwavesystems / dwavesystems/dwave-optimization

Style: Consider using trailing underscores for protected/private attributes and methods in C++

Open
#398 7 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
C++
Stars
31
Forks
36
Avg merge
16h 55m
Merged PRs (30d)
8

Description

Currently we follow [Google's C++ Style guide](https://google.github.io/styleguide/cppguide.html#Variable_Names) and use trailing underscores for protected/private attributes
```c++
class A {
public:
void a_method();
int a;
protected:
void b_method();
int b_;
private:
void c_method();
int c_;
};
```

I propose that we switch to using leading underscores for both attributes and methods in our C++ code base.
```c++
class A {
public:
void a_method();
int a;
protected:
void _b_method();
int _b;
private:
void _c_method();
int _c;
};
```

*Alternatives*

Use trailing underscores for both methods and attributes. This would be more C++-y and less Pythonic, but IMO less readable.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.