BOOST_UNLIKELY and boost::system::error_code
- Dominant language
- HTML
- Stars
- 8.6k
- Forks
- 1.9k
- Avg merge
- 39m
- Merged PRs (30d)
- 2
Description
Could you please modify the `BOOST_LIKELY` and `BOOST_UNLIKELY` macros in the following way:
```cpp
#define BOOST_LIKELY(x) (__builtin_expect(!!(x), 1))
#define BOOST_UNLIKELY(x) (__builtin_expect(!!(x), 0))
```
1. I cannot easily use `BOOST_UNLIKELY` with `boost::system::error_code`. Compiler complains
```
error: cannot convert ‘boost::system::error_code’ to ‘long int’ for argument ‘1’ to ‘long int __builtin_expect(long int, long int)’
[build] if (BOOST_UNLIKELY (ec)) {
[build] ^
```
To workaround the problem I should use macro like following:
```
if (BOOST_UNLIKELY (!!ec))
```
... which looks weird and causes unwanted questions during the code review.
2. I have to add extra braces:
```cpp
if (BOOST_UNLIKELY (!!ec))
^ -- here ^ --- and here
```
... instead of:
```cpp
if BOOST_UNLIKELY (ec)
{
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.