- Allman braces (
.clang-formatenforces this) - 4-space indentation, no tabs
- 100-column limit
- Run
make formatto auto-fix formatting
snake_casefor functions and variablesPascalCasefor types (structs, enums, typedefs)SCREAMING_CASEfor macros and enum valuesg_prefix for global variables
//for implementation comments (space after//)/** @brief */for public API documentation///<for struct field documentation- Never restate what the code does -- explain WHY
- Trailing
//comments only for non-obvious behavior - No em dashes, no decorative borders, no ASCII art
- Section dividers:
// ----(hyphens only) - New files:
// SPDX-License-Identifier: MITat top
- Standard headers first (
<stdio.h>,<stdlib.h>) - Internal headers grouped by module
- No blank lines between same-group includes
- Use quotes for internal headers, angle brackets for system
- Return codes for recoverable errors
zpanic_atfor unrecoverable (parser errors, user mistakes)- Check all allocation results (xmalloc never fails, but check anyway)