# CLAUDE.styleguide.md

## Comments
- Avoid unnecessary comments. Add a comment only where the behavior is ambiguous.

## Class members
- Declare members in this order: public variables → private variables → public functions → private functions.
- Prefix private member variables with `_` (e.g. `_var`), not `m_`.

## Definition order
- In a `.cpp`, order function definitions to match their declaration order in the corresponding `.h`.

## Types
- Prefer fixed-width integer types (`int32_t`, `uint64_t`, …) over plain `int` / `unsigned`.
- Prefer `constexpr` over `const` for compile-time constants.
- In printf-style calls (`SDL_Log*`, `SDL_snprintf`), format 64-bit integers with `SDL_PRIs64` / `SDL_PRIu64` / `SDL_PRIx64` — never `%lld`/`%llu` with casts. The underlying type of `int64_t`/`uint64_t` differs per platform (e.g. Android LP64), so a fixed specifier is a varargs type mismatch waiting to happen.

## Naming
- ECS component structs are prefixed with `C` (e.g. `CTransform`, `CPhysicsBody`, `CVelocity`).

## Null guards
- Do not guard release calls that are already null/zero-safe (`delete`, `SDL_free`, `glDelete*`). Write a guard only when it protects something else (e.g. a member call such as `x->Cleanup()` before the release, or a function without a documented null no-op guarantee).
- Do not handle allocation failure. No null check and no assert on an Out of Memory return — crashing naturally is the policy (guards were stripped from `crArray`, `PlaySfx`, `crFontAtlas`, and the preprocessor for this reason).
