Dependable C

Lobsters Hottest 工具

摘要

一个全面的资源,提供编写可靠、安全的C代码的指南和建议,涵盖未定义行为、内存模型以及特定版本的注意事项。

<p><a href="https://lobste.rs/s/plztql/dependable_c">评论</a></p>
查看原文
查看缓存全文

缓存时间: 2026/07/20 09:34

# 可靠的 C 语言 来源:https://dependablec.org/ 显式编程 菜单按钮 #### 引言 - [实现支持](https://dependablec.org/#ImplementationSuport) - [C 语言版本](https://dependablec.org/#C%20version) - [为何不修复 C](https://dependablec.org/#Why%20not%20fix%20C) #### 要求 - [要求](https://dependablec.org/#Requirements) #### 通用建议 - [警告](https://dependablec.org/#Warnings) - [C++ 兼容性](https://dependablec.org/#C++%20compatibility) - [标准库](https://dependablec.org/#Standard%20library) #### C 语言概念 - [如同规则](https://dependablec.org/#As-If) - [未定义行为](https://dependablec.org/#undefined%20behavior) #### 关键字 - [流程控制](https://dependablec.org/#flow%20control) - [关键字列表](https://dependablec.org/#keyword%20list) - [保留关键字](https://dependablec.org/#reserved%20keywords) #### 类型 - [字节序](https://dependablec.org/#Endianess) - [浮点数](https://dependablec.org/#floats) - [C 语言中的初始化](https://dependablec.org/#Initialization%20in%20C) - [类型大小](https://dependablec.org/#Types%20Sizes) - [布尔类型](https://dependablec.org/#%20Bool) #### 运算符 - [比较](https://dependablec.org/#Comparasions) - [移位](https://dependablec.org/#shifts) #### C 语言版本 - [C99](https://dependablec.org/#C99) - [C11](https://dependablec.org/#C11) - [C17](https://dependablec.org/#C17) - [C23](https://dependablec.org/#C23) #### 内存模型 - [变长数组(VLA)存在问题](https://dependablec.org/#VLAs%20are%20broken) - [并发](https://dependablec.org/#Concurrency) - [C 语言中的有效类型](https://dependablec.org/#Effective%20type%20in%20c) - [柔性数组成员](https://dependablec.org/#Flexible%20array%20member) - [建议](https://dependablec.org/#recomendations) #### 可靠的未定义行为 - [可靠的未定义行为](https://dependablec.org/#Dependable%20UB) #### 额外内容 - [内存调试器](https://dependablec.org/#Memory%20debugger) - [推文](https://dependablec.org/#tweets) - [为什么 C 是最安全的语言](https://dependablec.org/#Why%20is%20C%20the%20safest%20language) #### 关于 - [关于](https://dependablec.org/#About)

相似文章

C语言中的一切皆为未定义行为

Hacker News Top

一位经验丰富的C++开发者认为,所有非平凡的C和C++代码都包含未定义行为,使得内存安全无法实现,并质疑这些语言在现代软件开发中的持续使用。

关于C扩展、可移植性和替代编译器

Lobsters Hottest

本文讨论了编写可移植C代码的实际挑战,这些挑战源于对非标准编译器扩展和glibc条件头文件的依赖,并通过构建C编译器的示例进行说明。

C++26:标准库强化

Lobsters Hottest

C++26 引入了标准化的库强化机制,用于在运行时捕获常见的未定义行为(如越界访问)。基于 Google 的生产经验,此举仅带来 0.30% 的性能开销,同时将段错误减少了 30%。

回归构建模块的构建模块

Lobsters Hottest

本文类比了C/C++中的安全漏洞与Verilog中的安全漏洞,指出硬件描述语言的设计导致了缺陷,并认为行业应投资于更安全的替代方案,类似于软件领域对内存安全编程语言的推动。