Skip to content

Add Code Guidelines - #7110

Draft
Pepe20129 wants to merge 13 commits into
HarbourMasters:developfrom
Pepe20129:code_guidelines
Draft

Add Code Guidelines#7110
Pepe20129 wants to merge 13 commits into
HarbourMasters:developfrom
Pepe20129:code_guidelines

Conversation

@Pepe20129

@Pepe20129 Pepe20129 commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Add docs/CODE_GUIDELINES.md, this is a draft PR as there's still a lot of discussion to be had.

Currently the line about using libultra types over std ones is commented out as there's no consensus on it.

Github slightly messed up the rendering in the PR view, here's the correct rendering.

Build Artifacts

Comment thread docs/CODE_GUIDELINES.md
See these compatibility tables ([C](https://en.cppreference.com/c/compiler_support), [C++](https://en.cppreference.com/cpp/compiler_support)) for which features are supported by each compiler.

Do not use:
- [`goto`](https://en.cppreference.com/cpp/language/goto).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rg "\bgoto\b" | wc -l lists 855. goto has a place. the main trouble is when goto is jumping backwards

@Pepe20129 Pepe20129 Aug 23, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These guidelines are not for decomp code, in soh/soh/ there's only 3 uses of it:

OTRGlobals.cpp
484:            goto render;

resource\importer\AudioSoundFontFactory.cpp
379:            goto skip;

Enhancements\randomizer\3drando\fill.cpp
582:                goto resetSphere;

Also see section ES.76 of the C++ Core Guidelines.

Comment thread docs/CODE_GUIDELINES.md Outdated
Co-authored-by: Philip Dubé <159546+serprex@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants