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 f57289ea9774401c1f872bacd1067564b1011226). 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.
I just pushed some implementations of
HEDLEY_LIKELY
,HEDLEY_UNLIKELY
,HEDLEY_PREDICT
,HEDLEY_PREDICT_TRUE
, andHEDLEY_PREDICT_FALSE
to a new wip/c++2a branch (commit ID f57289ea9774401c1f872bacd1067564b1011226). 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.