Style: Consider using trailing underscores for protected/private attributes and methods in C++
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Refactor
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- cpp
- Domain
- developer-experience
Research direction
Read the linked Google C++ Style Guide and survey the repository's C++ naming conventions; no files or tests are named in the issue. Compare the proposed leading-underscore convention with the trailing-underscore alternative and confirm the preferred project-wide rule. Done would require an agreed convention and the repository-wide changes that follow from it.
Written by the indexing model from the issue text.
Description
Currently we follow Google's C++ Style guide and use trailing underscores for protected/private attributes
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.
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.
- Dominant language
- C++
- Stars
- 31
- Forks
- 36
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 4
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dwavesystems/dwave-optimization
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
dwavesystems/dwave-optimization#505 · 1 comment ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 65/100
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 65/100
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 35/100
All issues in dwavesystems/dwave-optimization
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
AXERA-TECH/ax-llm#77 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
games-on-whales/wolf#509 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
bug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
NVIDIA/cuda-samples#453 ·