Skip to content

败犬日报 2025-04-23

1. gdb 调试加断点找不到源文件

https://github.com/hellogcc/100-gdb-tips/blob/master/src/directory.md

2. gdb / lldb 实用小技巧

https://github.com/hellogcc/100-gdb-tips/blob/master/src/index.md

https://lldb.llvm.org/use/map.html

3. __builtin_arm_crc32b 这种函数如何编译

这个会直接对应到 ir。比如 https://github.com/openhwgroup/corev-gcc/commit/ea9ccb5690b3fa444c584fcdd0fcd16eb2541094

4. 又讨论了之前的 shared_ptr 传参问题

往期提到,传递指针(引用同理)需要保证局部使用不长期持有。事实上可以更扩展一点,就是如果保证指针、引用的生命周期可以被覆盖,这样传指针、引用都是没关系的。

这个地方更极端一点就是,所有同步的场景都可以不用 shared_ptr,生命周期都是可控的。反之多线程、事件驱动异步之类 shared_ptr 就是最佳实践。

5. std::function 可以 constexpr 吗

早着呢。

给 move_only_function 和 copyable_function 加 constexpr 刚有人写提案。