This series is the Chinese edition of the open source book C++ Best Practises[1], which provides a comprehensive introduction to the best practices of modern C++ projects from the perspectives of tools, code style, security, maintainability, portability, multithreading, performance, correctness, and more. This article is the seventh and final article in the series.

C++ Best Practices:

1. Tools

2. Code style

3. Security

4. Maintainability

5. Portability and multi-threading

6. Performance

7. Correctness and scripting (this article)


That’s right:

The above method, while better, still has a bidirectional implicit conversion between std::string and std::filesystem::p ath.

Consider using the following types of security libraries:

Note that stronger types also mean that the compiler can make more optimizations.

The combination of scripting and compiling languages is very powerful, both giving us the benefits of a compiled language we like (type safety, performance, thread-safe options, consistent memory model) and giving us the flexibility to quickly try new things without having to rebuild them completely.

Virtual machine-based compilation languages already do just that: JRuby, Jython, IronRuby, IronPython

Note: This series inspired O’Reilly’s series of videos: Learning C++ Best Practices[9]

Finally, try to expand your horizons and try other programming languages. Other languages have different constructs and expressions, and learning something else will encourage us to use C++ more creatively and write cleaner, more expressive code.

Hello, I am Yu Fan, did research and development in Motorola, and now does technical work in Mavenir, and has always maintained a strong interest in communications, networks, back-end architectures, cloud native, DevOps, CICD, blockchain, AI and other technologies, usually like to read, think, believe in continuous learning, lifelong growth, welcome to exchange and learn together. WeChat public account: DeepNoMind

C++ Best Practises:

Sorting in C vs C++:







Learning C++ Best Practices:

The C++ Core Guidelines:

The Ultimate Question of Programming, Refactoring, and Everything:

LLVM Coding Standards:

C++ Programming Style Guidelines:

Google C++ Style Guide:

C++ Super-FAQ:


In-Depth: Static Code Analysis:

Best Practice For C++ 11/14 Libraries:

cppcheck list of checks:


StackOverflow C++ FAQ:

CMake Documentation:


Basic CMake usage:

Effective Modern CMake:

It’s Time To Do CMake Right:

An Introduction to Modern CMake: