协作头脑风暴
brainstorming
在实现前澄清需求、探索设计选择,并形成清晰的开发方向。
ia-c-systems【开发与工程】C patterns for systems code, libraries, and native extensions: module layout, function decomposition, status-enum errors, memory safety, undefined behavior, and performance measurement. Use when writing, reviewing, refactoring, or debugging C, working with malloc lifetimes, buffer overflows, sanitizers, or Valgrind, or building native extensions. For…
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
name: ia-c-systems class: language description: >- C patterns for systems code, libraries, and native extensions: module layout, function decomposition, status-enum errors, memory safety, undefined behavior, and performance measurement. Use when writing, reviewing, refactoring, or debugging C, working with malloc lifetimes, buffer overflows, sanitizers, or Valgrind, or building native extensions. For C++, see ia-cpp-systems. paths:
Covers C11 and later for libraries, systems code, and native extensions. For C++ (RAII, templates, move semantics), see the ia-cpp-systems skill.
Read the repo's AGENTS.md/CLAUDE.md, its public headers, and two adjacent .c files before writing anything. Where they conflict with the rules below, they win, and the diff carries no note about it.
Do not skip this gate. Established C codebases sanction idioms these rules would otherwise flag:
| Local idiom | Where it is correct |
|---|---|
| Tab indentation | php-src and its extensions, Linux kernel |
goto cleanup / goto err | Kernel, OpenSSL, curl, php-src: the dominant multi-resource release idiom |
Macros containing return | RETURN_*/RETVAL_* in PHP extensions, Py_RETURN_* in CPython |
| Project status types | zend_result, CURLcode, int plus errno: do not invent a parallel enum beside one |
Never widen a scoped task into a repo-wide restyle because adjacent untouched C predates a rule here.
When the target is a PHP extension (php_*.h, PHP_FUNCTION, zend_, config.m4), load php-extension-c.md before applying any rule below. Layout, macros, the error model, memory, and assertions all carry extension-specific overrides, and the memory one in particular inverts the base guidance: extensions use a request-scoped allocator, not malloc/free.
-Wall -Wextra -Werror -Wconversion -Wshadow bundle, zero warnings)-fsanitize=address,undefined with zero reportsvalgrind --leak-check=full --error-exitcode=1 clean where the suite links under itgoto outside the repo's sanctioned form or the single-forward-jump cleanup; no recursion over external input; no loop over external input without a named boundRead the relevant reference before implementing or reviewing the matching behavior:
Existing specialized references, when the corresponding topic applies: