Skip to content

败犬日报 2024-11-22

1. 压缩算法 benchmark

https://quixdb.github.io/squash-benchmark/

2. 坑:std::numeric_limits<double>::min()

这个值是 double 能表示的最小正数。

然而 std::numeric_limits<int>::min() 是 int 最小数,这两个函数名一样意义却完全不同,设计不合理。

真正表示最小数的是 std::numeric_limits<double>::lowest(),是 C++11 打的补丁。

这个设计是 C 语言开的头,DBL_MIN 是最小正数,DBL_TRUE_MIN 是最小数,这个命名真是离大谱了。

群友:我写了 max,copilot 帮我补了下一句 min。

3. 推荐 vscode 插件:Interactive Git Log

图形化提交历史和 diff。

https://marketplace.visualstudio.com/items?itemName=interactive-smartlog.interactive-smartlog

4. boost::beast 不会自动填 Host 字段,Content-Length 字段要手动调用 prepare_payload() 才会填

阴间 HTTP 库。