Replace static constexpr with inline constexpr in headers (Fixes #4063) - #5083
Open
mouragst wants to merge 1 commit into
Open
Replace static constexpr with inline constexpr in headers (Fixes #4063)#5083mouragst wants to merge 1 commit into
mouragst wants to merge 1 commit into
Conversation
Replaces all 53 occurrences of 'static constexpr' with 'inline constexpr' in header files to avoid duplicate symbols in each compilation unit. Fixes otland#4063 When static constexpr is declared in a header file, every cpp file that includes that header gets its own copy of that value. Using 'inline' ensures the declarations are merged during linking and only one copy exists in the final executable. Affected files: - connection.h (2 changes) - const.h (5 changes) - definitions.h (8 changes) - creature.h (5 changes) - game.h (14 changes) - map.h (6 changes) - monsters.h (2 changes) - player.h (4 changes) - party.h (2 changes) - scheduler.h (1 change)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR replaces all 53 occurrences of
static constexprwithinline constexprin header files.Fixes #4063
As described in #4063, when
static constexpris declared in a header file, every compilation unit (cpp file) that includes that header gets its own copy of that value. Usinginline constexprensures the declarations are merged during linking and only one copy exists in the final executable, reducing binary size and avoiding potential ODR violations.Replaced
static constexprwithinline constexprin the following files:Total: 53 occurrences across 10 header files