Repository navigation
Conversation
68 enums become enum class. using enum keeps existing spellings such as IRT_EQ and IntVarBranch::SEL_RND compiling; class templates use static constexpr aliases instead, since using enum cannot name a dependent type. Enumerator values and order do not change. IntPropLevel is the only enum with operators and has an unsigned underlying type, because IntPropLevels stores levels in bit-fields. IPL_BITS_ is replaced by a private constant computed from the levels, and ev_t becomes EventType. Other conversions are now explicit, and installed headers need C++23. Zdev-Change-Id: Zbe6acb9cfd1f8806879c5c1a6bd306c2cf58f61134417b2e83c6ee379d2bce5f
Apply the approved constant renames with no compatibility aliases, following the IRT_LE to IRT_LT rename. RestartMode's RM_ constants become RESTART_, because ReifyMode shares that prefix, and truncated names such as SRT_DISJ and SOT_DUNION are spelled out. docs/code-style.md and the changelog list each rename. Enumerator values, printed strings, and option values do not change. Zdev-Change-Id: Z43bb475ac60ed9ff06a641cb09f52d90383860f01757f28f113e8f472c039503
This was referenced Nov 20, 2026
This branch has not been deployed
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.
Unscoped enums leak their enumerators into the enclosing namespace and convert implicitly to
int, hiding type mismatches and accidental integer arithmetic. This PR converts the remaining unscoped enums across the public and test headers toenum classand replaces heavily abbreviated constant names with descriptive ones.Scoped enums
The remaining unscoped enums across Gecode's modules and test component become
enum class, keeping their underlying values and order unchanged. To keep migrations manageable,using enumat each enclosing scope preserves existing spellings such asIRT_EQ,Gecode::SS_FAILED, andIntVarBranch::SEL_RND; in class templates, whereusing enumcannot name a dependent type,static constexpraliases provide the same names.What stops compiling is implicit conversion to
int, arithmetic or bit shifts (such as1 << RM_EQV), array indexing, streaming, and comparing across different enums. Call sites now convert explicitly withstd::to_underlyingorstatic_cast. Because installed headers usestd::to_underlying, downstream projects need C++23 even if they do not consume Gecode through CMake.IntPropLevelis the one enum that supports bitwise operations. It gets anunsigned intunderlying type (matching the bit-fields inIntPropLevels), gainsoperator|,operator&, andoperator|=, and dropsIPL_BITS_in favor of an internal constant. Testing a bit now requires an explicit comparison such as(ipl & IPL_BASIC) != IPL_DEF.ev_tis also renamed toInt::Cumulatives::EventType.Descriptive constant names
Following the
IRT_LE->IRT_LTrename in #286, abbreviated enum constants are given descriptive names without compatibility aliases. Examples includeRestartMode(RM_*->RESTART_*, removing the prefix collision withReifyMode),ReifyMode::RM_PMI->RM_RIMP,TaskType(TT_FIXP/TT_FIXS/TT_FIXE->TT_FIXED_PROCESSING/TT_FIXED_START/TT_FIXED_END),SetRelType(SRT_DISJ/SRT_CMPL->SRT_DISJOINT/SRT_COMPLEMENT), andSetOpType(SOT_DUNION/SOT_INTER->SOT_DISJOINT_UNION/SOT_INTERSECTION). Underlying values, printed output, and CLI option strings do not change;docs/code-style.mdandchangelog.inlist every rename.Stack
Merge in this order. #242 targets
main, and each later PR builds on the one before it so its diff shows only its own commits. The first four PRs are standalone search and random-number changes; #284 through #274 are the Gecode 7 changes split out of what used to be a single branch.