원클릭으로
code-style
// omath project C++ code style derived from .idea/codeStyles/Project.xml and .clang-format. Use when writing, editing, or reviewing C++ code in this repo so formatting and naming match the rest of the codebase.
// omath project C++ code style derived from .idea/codeStyles/Project.xml and .clang-format. Use when writing, editing, or reviewing C++ code in this repo so formatting and naming match the rest of the codebase.
| name | code-style |
| description | omath project C++ code style derived from .idea/codeStyles/Project.xml and .clang-format. Use when writing, editing, or reviewing C++ code in this repo so formatting and naming match the rest of the codebase. |
Authoritative sources: .clang-format (formatting) and .idea/codeStyles/Project.xml (Rider/CLion naming + formatting). When in doubt, run clang-format — it is the enforced formatter (clangFormatSettings.ENABLED = true).
Base style: LLVM with Stroustrup-style braces.
All — indent contents of every namespace.* / & in declarations: const Vector3& other, Type* ptr.Opening brace on its own line after:
class, struct, union, enum, namespace, function, control statement (if/for/while/switch), case label, lambda body, catch, else, while (of do-while), extern block.
Empty functions, records, and namespaces still split (SplitEmptyFunction/Record/Namespace: true).
Never collapse onto one line: blocks, functions, lambdas, if statements, loops.
template<class T> goes on its own line, declaration follows on the next line:
template<class Type>
requires std::is_arithmetic_v<Type>
class Vector3 : public Vector2<Type>
{
...
};
No space after template keyword. requires clause is not extra-indented.
if (, for (, while ().( in function declarations/definitions/calls.(int) x.for (auto& x : xs).| Kind | Style | Example |
|---|---|---|
| Namespaces | snake_case | omath::pathfinding, omath::primitives |
| Types (class, struct, enum, union, concept, type alias, typedef, template parameter) | PascalCase | Vector3, NavigationMesh, Astar, ContainedType |
| Functions (free + member) | snake_case | find_path, distance_to_sqr, create_box |
| Fields (class/struct/union members) | snake_case | dir_forward, nav_mesh |
| Variables (global, local, lambda) | snake_case | length_value, side_size |
| Parameters | snake_case | dir_right, v_other |
| Macros | UPPER_SNAKE_CASE | OMATH_FOO_BAR |
| Enumerators | UPPER_SNAKE_CASE | IMPOSSIBLE_BETWEEN_ANGLE, WORLD_POSITION_IS_OUT_OF_SCREEN_BOUNDS |
Enum types themselves are PascalCase (enum class Vector3Error, enum class Error); their members are UPPER_SNAKE_CASE.
.hpp, sources: .cpp. Both use snake_case filenames (e.g. vector3.hpp, proj_pred_engine_avx2.hpp)..h, sources: .c (no enforced filename style)..cu / .cuh..ixx, .mxx, .cppm, .ccm, .cxxm, .c++m.#pragma once only — no #ifndef guards.// Created by <name> on <date>.[[nodiscard]], noexcept, and constexpr on math / value-type methods.namespace omath is the root; sub-features live in nested namespaces (omath::collision, omath::engines::source_engine, etc.).} // namespace omath::primitives.std::expected<T, E> with an enum class …Error for fallible operations (see Vector3Error, projection::Error).Match the surrounding style exactly. If a region disagrees with this guide, prefer the existing local style — don't reformat unrelated code (per the project's CLAUDE.md "Surgical Changes" rule). Run clang-format on touched files before committing.