This commit is contained in:
blueloveTH 2023-10-10 18:19:32 +08:00
parent bb0bd293a0
commit 13ee2c3c04
2 changed files with 12 additions and 5 deletions

View File

@ -158,7 +158,7 @@ All kinds of contributions are welcome.
- any suggestions - any suggestions
- any questions - any questions
Check our [Coding Style Guide](https://pocketpy.dev/coding_style_guide/) if you want to contribute C++ code. If you find this project useful, consider star this repository (●'◡'●)
## Reference ## Reference

View File

@ -6,7 +6,14 @@ label: Coding style guide
# Coding Style Guide # Coding Style Guide
## Naming rules
## For Python
Use [PEP-8](https://www.python.org/dev/peps/pep-0008/) as the coding style guide.
## For C++
### Naming rules
For class names, always use **PascalCase** For class names, always use **PascalCase**
@ -53,7 +60,7 @@ For macros, use **SNAKE_CASE**
#define TEST(x) x+1 #define TEST(x) x+1
``` ```
## Access control ### Access control
Please use python style access control. Please use python style access control.
@ -74,7 +81,7 @@ public:
It does not forbid users to access internal members. It does not forbid users to access internal members.
## Use compact style ### Use compact style
Try to make the code compact if it does not affect readability. Try to make the code compact if it does not affect readability.
@ -88,7 +95,7 @@ if(x == 1){
} }
``` ```
## For `std::shared_ptr<T>` ### For `std::shared_ptr<T>`
Use a `_` suffix to indicate a type is a shared pointer. Use a `_` suffix to indicate a type is a shared pointer.