Skip to content

Rename unexpected to condition_unlikely to prevent clashing with std::unexpected - #314

Open
mikomikotaishi wants to merge 1 commit into
thpatch:masterfrom
mikomikotaishi:chore/rename-unexpected
Open

Rename unexpected to condition_unlikely to prevent clashing with std::unexpected#314
mikomikotaishi wants to merge 1 commit into
thpatch:masterfrom
mikomikotaishi:chore/rename-unexpected

Conversation

@mikomikotaishi

@mikomikotaishi mikomikotaishi commented Aug 24, 2026

Copy link
Copy Markdown

This PR renames the unexpected macro to condition_unlikely. Because C++23 reintroduces the name std::unexpected<E>, this change is needed to remove the possibility of clashing with the standard on later versions. condition_unlikely seems like a more reasonable name, because rather than implying that it should never be expected, it indicates what the hot paths ([[likely]]/[[unlikely]] attributes) are.

CXXFLAGS += -D_GLIBCXX_USE_DEPRECATED=0 was done originally to eliminate the deprecated std::unexpected() (deprecated in C++11 and removed in C++17). Because the macro has been renamed, this is no longer needed.

@mikomikotaishi
mikomikotaishi force-pushed the chore/rename-unexpected branch 2 times, most recently from 87faaaa to d9da8ba Compare August 24, 2026 22:21
@mikomikotaishi
mikomikotaishi force-pushed the chore/rename-unexpected branch from d9da8ba to 666b1c1 Compare August 24, 2026 22:22
@mikomikotaishi mikomikotaishi changed the title Rename unexpected to case_unexpected to prevent clashing with std Rename unexpected to condition_unlikely to prevent clashing with std::unexpected Aug 24, 2026
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.

1 participant