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

C++ Naming Style #189

Open
Qingquan-Li opened this issue Jun 3, 2022 · 0 comments
Open

C++ Naming Style #189

Qingquan-Li opened this issue Jun 3, 2022 · 0 comments
Labels

Comments

@Qingquan-Li
Copy link
Owner

Qingquan-Li commented Jun 3, 2022

1. Common C++ Naming Conventions

https://github.com/cpp-best-practices/cppbestpractices/blob/master/03-Style.md


  • Projects and Files start with upper case (UpperCamelCase / PascalCase):

    MyProject
    
    HelloWorld.cpp
    
  • Types start with upper case (UpperCamelCase / PascalCase):

    MyClass
    
  • Functions and variables start with lower case (lowerCamelCase):

    myMethod()
    string userName;
  • Constants are all upper case:

    const double PI = 3.14159265358979323;
    const double EULER_NUMBER = 2.71828

2. Google C++ Style Guide

https://google.github.io/styleguide/cppguide.html#Naming


  • File Names

    Filenames should be all lowercase and can include underscores (_) or dashes (-), prefer "_".

    my_useful_class.cpp
    
  • Type Names

    Type names start with a capital letter and have a capital letter for each new word, with no underscores.

    MyExcitingClass
    
  • Variable Names

    The names of variables (including function parameters) and data members are all lowercase, with underscores between words.

    string table_name;
    
  • Function Names

    Ordinarily, functions should start with a capital letter and have a capital letter for each new word.

    DeleteUrl()
    
@Qingquan-Li Qingquan-Li added the C++ label Jun 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant