public:it:cplusplus

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

两侧同时换到之前的修订记录 前一修订版
后一修订版
前一修订版
public:it:cplusplus [2021/12/07 08:56] – [C++资源与工具] oakfirepublic:it:cplusplus [2024/03/15 11:22] (当前版本) – [Articles] oakfire
行 23: 行 23:
 ---- ----
 ===== Articles ===== ===== Articles =====
-  * [[http://codemacro.com/2014/09/02/stack-frame/|手动调用堆栈]]+  * <del>[[http://codemacro.com/2014/09/02/stack-frame/|手动调用堆栈]]</del>
   * [[public:it:cplusplus:effective_modern_cplusplus]]   * [[public:it:cplusplus:effective_modern_cplusplus]]
   * [[http://mindhacks.cn/2012/08/27/modern-cpp-practices/|modern cpp practices]]   * [[http://mindhacks.cn/2012/08/27/modern-cpp-practices/|modern cpp practices]]
行 30: 行 30:
   * [[https://github.com/changkun/modern-cpp-tutorial/blob/master/README-zh-cn.md|Modern cpp tutorial]]   * [[https://github.com/changkun/modern-cpp-tutorial/blob/master/README-zh-cn.md|Modern cpp tutorial]]
   * [[https://google.github.io/styleguide/cppguide.html|Google C++ Style Guide]]   * [[https://google.github.io/styleguide/cppguide.html|Google C++ Style Guide]]
 +  * [[https://github.com/google/sanitizers/wiki/AddressSanitizer|AddressSanitizer]] 内存错误检测:-o
 +    * Meson 构建系统打开 ASAN 的方式:[[https://mesonbuild.com/Builtin-options.html#base-options|设置 b_sanitize]]
 +  * [[https://agraphicsguynotes.com/posts/fiber_in_cpp_understanding_the_basics/|Fiber in C++: 纤程的原理与实现]]
 +  * [[https://learnmoderncpp.com/|Learn Modern C++]]
  
 ===== Syntax ===== ===== Syntax =====
行 42: 行 46:
     * 正则 std::regex     * 正则 std::regex
     * 随机数相关 ''<random>''     * 随机数相关 ''<random>''
 +    * 关于 shared_ptr 的线程安全:[[https://www.boost.org/doc/libs/1_73_0/libs/smart_ptr/doc/html/smart_ptr.html#shared_ptr_thread_safety|shared_ptr_thread_safety]]
   * c++ 14 新增 std::make_unique, std::shared_timed_mutex, std::shared_lock, std::integer_sequence, std::exchange, std::quoted   * c++ 14 新增 std::make_unique, std::shared_timed_mutex, std::shared_lock, std::integer_sequence, std::exchange, std::quoted
   * c++ 17 新增 std::variant, std::optional, std::any, std::apply, std::string_view, std::shared_mutex   * c++ 17 新增 std::variant, std::optional, std::any, std::apply, std::string_view, std::shared_mutex
行 65: 行 70:
   * ''vector<bool>''既不是 vector, 也不存 bool, 更不是容器。C++98 起就对它进行按位存储优化空间,导致行为差异。   * ''vector<bool>''既不是 vector, 也不存 bool, 更不是容器。C++98 起就对它进行按位存储优化空间,导致行为差异。
   * ''std::ios::binary'' [[https://gcc.gnu.org/onlinedocs/libstdc++/manual/fstreams.html#std.io.filestreams.binary|可能达不到你想要的效果]]   * ''std::ios::binary'' [[https://gcc.gnu.org/onlinedocs/libstdc++/manual/fstreams.html#std.io.filestreams.binary|可能达不到你想要的效果]]
 +  * ''std::copy'' 性能可能比 ''memcpy'' 更好: https://stackoverflow.com/questions/4707012/is-it-better-to-use-stdmemcpy-or-stdcopy-in-terms-to-performance
 ==== › Meta Pragram ==== ==== › Meta Pragram ====
   * {{:public:it:ccc.ppt| 模​板​元​编​程​技​术​与​应​用​}}   * {{:public:it:ccc.ppt| 模​板​元​编​程​技​术​与​应​用​}}
行 147: 行 153:
     * For a native linker on an ELF system, if the file ''/etc/ld.so.conf'' exists, the list of directories found in that file.     * For a native linker on an ELF system, if the file ''/etc/ld.so.conf'' exists, the list of directories found in that file.
   * 由上,如果不想混淆系统lib, 程序可自行用 ''LD_LIBRARY_PATH'' 环境变量指定自己的lib目录。   * 由上,如果不想混淆系统lib, 程序可自行用 ''LD_LIBRARY_PATH'' 环境变量指定自己的lib目录。
 +==== › Tips ====
 +  * 禁用异常的编译选项:''-fno-exceptions''
 +  * 有返回值声明的函数末尾如果没有返回, gcc 7.5 版本编译时会默认加个 return 0,  但之后的版本应该是和 clang 一样不加了。c++11 标准,有返回值声明的函数末尾如果没有返回,将出现未定义行为。所以按理这个情况编译器应该报错,但  gcc  编译只报了 warning , 而运行时没有返回值导致的 crash 栈信息都很奇怪不好查。 所以gcc7.5之后的编译参数都得加上   ''-Werror=return-type''  ,这样没有返回值时编译期可以报error,好规避问题。
 +  * gcc/g++ 优化级别详细查看:''gcc -Q --help=optimizers -O1''
 +
 +
 ===== C++资源与工具 ===== ===== C++资源与工具 =====
   * [[https://github.com/fffaraz/awesome-cpp|awesome-cpp]]   * [[https://github.com/fffaraz/awesome-cpp|awesome-cpp]]
行 153: 行 165:
 ==== › Build System ==== ==== › Build System ====
   * [[.:cmake]]  - Cross-platform free and open-source software for managing the build process of software using a compiler-independent method. [BSD]   * [[.:cmake]]  - Cross-platform free and open-source software for managing the build process of software using a compiler-independent method. [BSD]
-  * [[https://ninja-build.org/|Ninja]] - Ninja is a small build system with a focus on speed.[Apache 2.0]+  * [[https://ninja-build.org/|Ninja]] - Ninja is a small build system with a focus on speed.[Apache 2.0], 对标Make, 专注速度 
 +  * autotools 
 +  * [[gyp]] 
 +  * [[https://mesonbuild.com/|meson]] - Meson is an open source build system meant to be both extremely fast, and, even more importantly, as user friendly as possible. (python) 
 +==== › 包管理 ====
   * [[https://github.com/microsoft/vcpkg|Vcpkg]] - C++ library manager for Windows, Linux, and MacOS. [MIT]   * [[https://github.com/microsoft/vcpkg|Vcpkg]] - C++ library manager for Windows, Linux, and MacOS. [MIT]
     * vcpkg 安装的库默认都可以向后兼容,更新方法为直接git pull 最新vcpkg然后 vcpkg update/upgrade, 如果为了协作与稳定,可以指定 git checkout vcpkg 的某个tag, 来保证彼此库版本一致。     * vcpkg 安装的库默认都可以向后兼容,更新方法为直接git pull 最新vcpkg然后 vcpkg update/upgrade, 如果为了协作与稳定,可以指定 git checkout vcpkg 的某个tag, 来保证彼此库版本一致。
     * vcpkg 没有注册表设置或环境变量,卸载直接删除文件夹即可;可在一台计算机上设置任意数量的 vcpkg,它们彼此互不干扰。     * vcpkg 没有注册表设置或环境变量,卸载直接删除文件夹即可;可在一台计算机上设置任意数量的 vcpkg,它们彼此互不干扰。
   * [[https://github.com/cpp-pm/hunter|hunter]] - CMake driven cross-platform package manager for C/C++   * [[https://github.com/cpp-pm/hunter|hunter]] - CMake driven cross-platform package manager for C/C++
-  * [[https://conan.io/|Conan]] - the C/C++ Package Manager, 结合 [[https://jfrog.com/|JFrog]] 可构建私有C/C++二进制包管理 +  * :-D[[.:cplusplus:conan]] [[https://conan.io/]] - the C/C++ Package Manager, 结合 [[https://jfrog.com/|JFrog]] 可构建私有C/C++二进制包管理 
-    * conan 的[[https://docs.conan.io/en/latest/reference/generators/cmake.html|cmake 变量表]]+
 ==== › 用到的 ==== ==== › 用到的 ====
   * [[https://github.com/facebook/folly|Folly]] - Folly is a library of C++14 components designed with practicality and efficiency in mind. Folly contains a variety of core library components used extensively at Facebook. [Apache2]   * [[https://github.com/facebook/folly|Folly]] - Folly is a library of C++14 components designed with practicality and efficiency in mind. Folly contains a variety of core library components used extensively at Facebook. [Apache2]
行 171: 行 187:
   * [[http://valgrind.org/|valgrind]] - A tool for memory debugging, memory leak detection, and profiling.   * [[http://valgrind.org/|valgrind]] - A tool for memory debugging, memory leak detection, and profiling.
   * [[https://github.com/nlohmann/json|nlohmann-json]] -  JSON for Modern C++. [MIT]   * [[https://github.com/nlohmann/json|nlohmann-json]] -  JSON for Modern C++. [MIT]
 +  * [[https://github.com/sogou/workflow|Sogou C++ Workflow]] - This is an enterprise-level programming engine in light and elegant design which can satisfy most C++ back-end development requirements.[Apache-2.0]
 +  * [[https://github.com/yhirose/cpp-httplib|cpp-httplib]] - A C++11 single-file header-only cross platform HTTP/HTTPS library.[MIT]
  
  
  • public/it/cplusplus.1638838597.txt.gz
  • 最后更改: 2021/12/07 08:56
  • oakfire