Last Updated: November 13, 2026
This guide is maintained with AI-assistance. Please refer to our AI policy.
This guide is written for both human and AI contributors. Some things are here to explicitly steer AI output and may not necessarily apply to typical human contributions. Adherence to the guide is a preference, not an expectation. Much of the existing code throughout Huntr Software projects has not been updated to conform to the guide; that is still a work-in-progress. Expect this guide to change significantly as the conformance pass continues.
Read through this guide to learn how C++ code is styled for Huntr Software projects, and how docs, changelogs, and other project writing should read. Each project's CONTRIBUTING.md holds its own conventions (type prefixes, namespaces, export macros, the copyright header), while this guide covers what they share.
New code follows this guide. Older code that doesn't conform should be updated one file at a time (a source file and its header count as one), in a commit of its own, never mixed with a behavior change. Until a file is converted, edits inside it should match the surrounding code.
if (!callback) return;.bool expanded{ false }.&&, ||, +, ==, ...) ends with the operator, rather than the next line starting with it.* and & bind to the type: LLayer* layer, const LString& path.if or loop that does one job, or a call that takes a multi-line lambda.LLayer* find_or_create(LLayer* parent, const LString& name)
{
if (LLayer* existing = parent->find_layer(name))
return existing;
return lMake<LLayer>(parent, name);
}
LEngine::LEngine() : pimpl{ new Impl() } {}
LEngine::~LEngine() { delete pimpl; }
LEngine).version_token, not kVersionToken).callback, settings, file, not cb, s, f. A loop index can stay i.m_ prefix (m_tokens), so they never clash with a parameter of the same name. Public struct fields don't.b for booleans. Name a boolean so it reads as yes or no: expanded, is_open, has_file.enum class values are PascalCase.new_, old_, v2, or plan and slice numbers.#pragma once: #ifndef LENGINE_H closing with #endif // LENGINE_H..cpp, its own header first, then the standard library, then project headers.static functions in the .cpp.Documentation lives in headers, and a .cpp stays clean.
/** */ block directly above the declaration. Each line starts with *, and text sits two spaces after the star. Editors show these blocks on hover, and Docuriser strips the stars and renders the rest as Markdown: backticks for identifiers, cpp code blocks for examples, ### headings to section a long class doc./**
* Finds a layer by its path.
*
* Returns `nullptr` when no layer matches.
*/
LLayer* find_layer(const LString& path);
.lyr files..."). Then add what a caller needs: return values, failure behavior, ordering requirements.0 means, or a surprise that would trip up a caller. Use a longer block only when a caller would get the member wrong without one, like a list of options.**Insert only**:, **Android only**:.rs is the style to scale, from resolve_style()."[`VApp::bind_height()`](vapp.html#bind_height). Classes and structs have their own page, while enums and free functions sit on their header's page (vrender.h.html#VNodeType). A helper type points back to the API that uses it..lyr snippet, takes trailing comments that show what it produces:Label << Vortex/Text:
Font.Size: 14 // 17.5 with a `font_scale` of 1.25
Margins.Top: 4 @Mobile: 12 // 12, since it has an `@Mobile` value
// comment when it fits on the line within about 90 columns, with no closing period and any unit in parentheses: // Top-left corner radius (px). Anything longer gets a /** */ block above the member instead.url)..cpp, comment only what the code can't say for itself, and say why rather than what:// States are child attributes, so the recursive walk covers them too.
for (LAttribute* attr : pimpl->root->find_children<LAttribute>(true))
.cpp comment longer than one line goes in a /* */ block, with its text indented one tab:/*
Qt 6.10's PipeWire audio backend can crash (see QTBUG-144712), so use
the PulseAudio one (also served by PipeWire) until Qt 6.11.1 is common.
*/
if (!qEnvironmentVariableIsSet("QT_AUDIO_BACKEND"))
qputenv("QT_AUDIO_BACKEND", "pulseaudio");
CHANGELOG.md.test-cycles, test-lexer), never for the plan or change that produced it.nullptr, never NULL or 0.auto only where the type is obvious or verbose (iterators, range-for elements); spell it out otherwise.const&, and mark methods that don't mutate const.enum class over plain enum.For JavaScript, CMake, shell, and the rest, match the style of the surrounding code. The comment rules above apply everywhere.
These rules cover all project writing: doc comments, guides, READMEs, changelogs, and site text.
CHANGELOG.md entry in the same commit as the change, under ## [?] - Unreleased at the top until the release's version is set.### Added, ### Changed, ### Fixed, and ### Removed. Add ### Migration when users must act, or ### Recommended when the old way still works but a new one is preferred.