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)
Mistake:
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: https://lefticus.gitbooks.io/cpp-best-practices/content/
Sorting in C vs C++: https://lefticus.gitbooks.io/cpp-best-practices/content/Sorting%20in%20C%20vs%20C++.pdf
ChaiScript: http://chaiscript.com/
AngelScript: http://www.angelcode.com/angelscript/
luabind: http://www.rasterbar.com/products/luabind.html
sol2: https://github.com/ThePhD/sol2
SWIG: http://www.swig.org/
pybind11: https://pybind11.readthedocs.io/en/stable
Learning C++ Best Practices: http://shop.oreilly.com/product/0636920049814.do
The C++ Core Guidelines: https://github.com/isocpp/CppCoreGuidelines
The Ultimate Question of Programming, Refactoring, and Everything: https://pvs-studio.com/en/blog/posts/cpp/0391/
LLVM Coding Standards: https://llvm.org/docs/CodingStandards.html
C++ Programming Style Guidelines: https://geosoft.no/development/cppstyle.html
Google C++ Style Guide: https://google.github.io/styleguide/cppguide.html
C++ Super-FAQ: https://isocpp.org/faq/
cplusplus: http://www.cplusplus.com/
In-Depth: Static Code Analysis: https://www.gamedeveloper.com/programming/in-depth-static-code-analysis
Best Practice For C++ 11/14 Libraries: https://svn.boost.org/trac10/wiki/BestPracticeHandbook
cppcheck list of checks: https://sourceforge.net/p/cppcheck/wiki/ListOfChecks/
EmptyCrate: https://articles.emptycrate.com/
StackOverflow C++ FAQ: http://stackoverflow.com/questions/tagged/c%2b%2b-faq?sort=votes&pageSize=15
CMake Documentation: https://cmake.org/cmake/help/latest/manual/cmake.1.html
learning-cmake: https://github.com/Akagi201/learning-cmake
Basic CMake usage: https://codingnest.com/basic-cmake/
Effective Modern CMake: https://gist.github.com/mbinna/c61dbb39bca0e4fb7d1f73b0d66a4fd1
It’s Time To Do CMake Right: https://pabloariasal.github.io/2018/02/19/its-time-to-do-cmake-right/
An Introduction to Modern CMake: https://cliutils.gitlab.io/modern-cmake/