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

Stabilize new naming conventions #1044

Open
ken-matsui opened this issue Nov 24, 2024 · 0 comments
Open

Stabilize new naming conventions #1044

ken-matsui opened this issue Nov 24, 2024 · 0 comments

Comments

@ken-matsui
Copy link
Member

ken-matsui commented Nov 24, 2024

Idea

  • Files/Directories: PascalCase
  • Types/Classes: PascalCase
  • Variables: snake_case
  • Class (non-struct) Member Variables: snake_case_
  • Functions: camelCase
  • Class (non-struct) Methods: camelCase_

Reasoning/Explanation

  • Variables use snake_case since they tend to be shorter than functions.
  • Why not the m prefix?
    • We need to use m_ for snake_case and m for camelCase.
    • m_ and m are inconsistent.
    • m_snake_case is longer than snake_case_.
  • Class Members and non-members (and struct members) are distinguished by the _ suffix, which is similar to Google's C++ Coding Style.
    • The difference is that we apply this pattern to methods as well.
  • Only class members have the _ suffix because they have methods and within methods, variables/functions and members are hard to be distinguished. (Structs won't have methods. => this is different from Google's)

Steps to apply this new policy

  1. Apply Class vs Struct style.
  2. Apply the new Class (non-struct) Methods naming convention.
  3. Apply the new Class (non-struct) Member Variables naming convention.
  4. Apply the new Variables naming convention.

See also

@ken-matsui ken-matsui changed the title Stabilize naming conventions Stabilize new naming conventions Nov 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant