public:it:cplusplus

差别

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

到此差别页面的链接

两侧同时换到之前的修订记录 前一修订版
后一修订版
前一修订版
public:it:cplusplus [2023/10/13 09:11] – [› 用到的] oakfirepublic:it:cplusplus [2025/02/17 14:59] (当前版本) – [Articles] oakfire
行 32: 行 32:
   * [[https://github.com/google/sanitizers/wiki/AddressSanitizer|AddressSanitizer]] 内存错误检测:-o   * [[https://github.com/google/sanitizers/wiki/AddressSanitizer|AddressSanitizer]] 内存错误检测:-o
     * Meson 构建系统打开 ASAN 的方式:[[https://mesonbuild.com/Builtin-options.html#base-options|设置 b_sanitize]]     * 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++]]
 +  * [[https://blogs.gentoo.org/mgorny/2024/09/23/overview-of-cross-architecture-portability-problems/|C的移植性问题,参考]]
  
 ===== Syntax ===== ===== Syntax =====
行 46: 行 49:
     * 关于 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]]     * 关于 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::filesystem+    * 读写锁 std::shared_mutex 
 +    * 文件操作相关 std::filesystem
   * c++ 20 新增 std::format, 基于[[https://docs.python.org/3/library/string.html#formatspec|python格式化规范]]   * c++ 20 新增 std::format, 基于[[https://docs.python.org/3/library/string.html#formatspec|python格式化规范]]
-    * 可中断线程  std::jthread, std::stop_toke+    * 可中断线程  std::jthread, std::stop_token 
 +    * 并发控制 std::barrier, std::latch 
 +    * 协程关键字 co_await, co_yield, co_return 
 +    * 操作 std::ranges, std::views
     * 原子引用 std::atomic_ref     * 原子引用 std::atomic_ref
     * 数学常数 std::numbers     * 数学常数 std::numbers
行 154: 行 161:
   * 禁用异常的编译选项:''-fno-exceptions''   * 禁用异常的编译选项:''-fno-exceptions''
   * 有返回值声明的函数末尾如果没有返回, gcc 7.5 版本编译时会默认加个 return 0,  但之后的版本应该是和 clang 一样不加了。c++11 标准,有返回值声明的函数末尾如果没有返回,将出现未定义行为。所以按理这个情况编译器应该报错,但  gcc  编译只报了 warning , 而运行时没有返回值导致的 crash 栈信息都很奇怪不好查。 所以gcc7.5之后的编译参数都得加上   ''-Werror=return-type''  ,这样没有返回值时编译期可以报error,好规避问题。   * 有返回值声明的函数末尾如果没有返回, gcc 7.5 版本编译时会默认加个 return 0,  但之后的版本应该是和 clang 一样不加了。c++11 标准,有返回值声明的函数末尾如果没有返回,将出现未定义行为。所以按理这个情况编译器应该报错,但  gcc  编译只报了 warning , 而运行时没有返回值导致的 crash 栈信息都很奇怪不好查。 所以gcc7.5之后的编译参数都得加上   ''-Werror=return-type''  ,这样没有返回值时编译期可以报error,好规避问题。
 +  * gcc/g++ 优化级别详细查看:''gcc -Q --help=optimizers -O1''
  
  
  • public/it/cplusplus.1697159462.txt.gz
  • 最后更改: 2023/10/13 09:11
  • oakfire