Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace unweildy COMPILE_ASSERT macro with static_assert #1344

Merged

Conversation

bluebandit21
Copy link
Member

When this codebase was originally written, there wasn't a built-in
cross-compiler way to add compile-time asserts, so the original
authors did something clever by forcing the compile-time
instantiation of a undefined template class if a precondition was
not met.

However, this produces a wall of insane template errors all wrapped
within macro expansions that is completely unintelligible if you
haven't seen it before.

Since C++11 we have static_assert for the same purpose, and can
produce nice diagnostic strings as an added bonus :)

When this codebase was originally written, there wasn't a built-in
 cross-compiler way to add compile-time asserts, so the original
 authors did something clever by forcing the compile-time
 instantiation of a undefined template class if a precondition was
 not met.

However, this produces a wall of insane template errors all wrapped
 within macro expansions that is completely unintelligible if you
 haven't seen it before.

Since C++11 we have static_assert for the same purpose, and can
 produce nice diagnostic strings as an added bonus :)
@bluebandit21
Copy link
Member Author

Old:
Screen Shot 2025-01-07 at 11 28 08 AM

New:
Screen Shot 2025-01-07 at 11 21 02 AM

@poco0317 poco0317 merged commit 911d482 into etternagame:develop Jan 11, 2025
14 checks passed
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