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

C++2a-based likely/unlikely/predict... macros #29

Open
nemequ opened this issue Oct 14, 2019 · 1 comment
Open

C++2a-based likely/unlikely/predict... macros #29

nemequ opened this issue Oct 14, 2019 · 1 comment

Comments

@nemequ
Copy link
Owner

nemequ commented Oct 14, 2019

I just pushed some implementations of HEDLEY_LIKELY, HEDLEY_UNLIKELY, HEDLEY_PREDICT, HEDLEY_PREDICT_TRUE, and HEDLEY_PREDICT_FALSE to a new wip/c++2a branch (commit ID f57289e). They work as expected on GCC 9 (AFAIK the only compiler which supports the [[likely]]/[[unlikely]] attributes, but I'd like to do a bit more testing before including them in a release.

The good news is that Microsoft generally implements new C++ features (unlike C), so the next release of Visual Studio will probably support the required attributes, meaning we may actually get a working implementation on MSVC. Most other compilers already support __builtin_expect, so MSVC is where this should be important.

@travisdowns
Copy link
Collaborator

Nice to see this finally getting some love in the standard.

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

No branches or pull requests

2 participants