返回顶部
C

C

Write safe C avoiding memory corruption, buffer overflows, and undefined behavior traps.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.1
安全检测
已通过
971
下载量
2
收藏
概述
安装方式
版本历史

C

## Quick Reference | Topic | File | |-------|------| | malloc/free, leaks, double free | `memory.md` | | Null, dangling, pointer arithmetic | `pointers.md` | | Null terminator, buffer overflow | `strings.md` | | Integer overflow, signed/unsigned | `types.md` | | Macro traps, include guards | `preprocessor.md` | | Common undefined behavior | `undefined.md` | ## Critical Rules - `malloc` returns `void*` — cast required in C++, optional in C but check for NULL - `free(ptr); ptr = NULL;` — always null after free to prevent double-free - `sizeof(array)` in function gives pointer size, not array size — pass length separately - `char str[5] = "hello";` — no room for null terminator, UB when used as string - `strcpy` doesn't check bounds — use `strncpy` and manually null-terminate - Signed overflow is UB — compiler can optimize assuming it never happens - `i++ + i++` is UB — no sequence point between modifications - Returning pointer to local variable — dangling pointer, UB on use - `#define SQUARE(x) x*x` — `SQUARE(1+2)` = `1+2*1+2` = 5, not 9 - `memcpy` with overlapping regions — use `memmove` instead - Uninitialized variables — contain garbage, UB if used - Array out of bounds — no runtime check, silent corruption or crash

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 c-1776108492 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 c-1776108492 技能

通过命令行安装

skillhub install c-1776108492

下载 Zip 包

⬇ 下载 C v1.0.1

文件大小: 4.07 KB | 发布时间: 2026-4-14 14:21

v1.0.1 最新 2026-4-14 14:21
Initial release

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部