Skip to content

Style Guide

Drahsid edited this page Apr 30, 2026 · 4 revisions

Style Guide

These rules apply unless matching the ROM requires otherwise.

Naming

Type Style
Function Pascal_Snake_Case
Uncategorized function PascalCase
Struct/type Pascal_Snake_Case
Struct member camelCase
Local variable snake_case
Global variable gCamelCase
Static variable sCamelCase
Enum type eCamelCase
Enumerator/define/const SNAKE_CASE_CAPS

Unknown symbols stay as func_XXXXXXXX / D_XXXXXXXX until the name is high-confidence.

Use arg0, arg1, etc. for unverified function parameters. Prefer wide names for known locals: index, jndex, qndex, etc.

Types

Use fixed-width types: u8, s8, u16, s16, u32, s32, u64, s64, f32, f64 unless matching requires otherwise.

Formatting

Minorly modified Stroustrup style:

Indent with 4 spaces. Braces stay on the same line. else and else if go on a new line.

Pointers bind left: u8* data.

Avoid one-line bodies except empty stubs when they match.

Prefer // comments. Keep comments sparse and useful.

Nonmatching Code

#ifdef NON_MATCHING
// function
#else
#pragma GLOBAL_ASM("asm/nonmatchings/path/function.s")
#endif

Clone this wiki locally