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

Switch platform-dependent likely/unlikely macros to use C++20 standard attributes #239

Open
AdamGlustein opened this issue May 21, 2024 · 0 comments
Labels
lang: c++ Issues and PRs related to the C++ codebase type: enhancement Issues and PRs related to improvements to existing features

Comments

@AdamGlustein
Copy link
Collaborator

Now that we have upgraded to C++20, we can use the [[likely]] / [[unlikely]] attributes that are now part of the official standard rather having platform-dependent likely/unlikely macros in https://github.com/Point72/csp/blob/main/cpp/csp/core/Likely.h.

The change however seems pretty tedious since the attribute needs to be at the beginning/ending of the line, i.e. if(x) [[likely]] rather than in the if-statement like if( __builtin_expect( x, 0 ) ). So I think we'd have to make this change manually, we can't just change the macros or use a script for all cases.

@AdamGlustein AdamGlustein added type: enhancement Issues and PRs related to improvements to existing features lang: c++ Issues and PRs related to the C++ codebase labels May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang: c++ Issues and PRs related to the C++ codebase type: enhancement Issues and PRs related to improvements to existing features
Projects
None yet
Development

No branches or pull requests

1 participant