eclipse-iceoryx / eclipse-iceoryx/iceoryx
Mark iox container operations which return bool as [[nodiscard]]
- Dominant language
- C++
- Stars
- 2.2k
- Forks
- 492
- Avg merge
- 18h 57m
- Merged PRs (30d)
- 1
Description
## Brief feature description
Marking any operation in iox containers which may fail and return bool as `[[nodiscard]]`
## Detailed information
The idea here is pretty straightforward. Taking `iox::vector` for example, the API for push back returns `bool` as compared to `void` of `std::vector::push_back`.
https://github.com/eclipse-iceoryx/iceoryx/blob/f0696966c51e35b6c8f84290d40df7f87c6ed19c/iceoryx_hoofs/container/include/iox/vector.hpp#L200-L203
Marking this code as `[[nodiscard]]` will raise compiler warnings in the event that a user is pushing back blindly onto an `iox::vector` and not handling the case where it fails. If the user has performed size checks at the beginning of a loop, they can simply use ...
```
std::ignore = my_iox_vector.push_back(value);
```
If the iceoryx team is aligned with this approach, I can put up a PR to add the nodiscards
Contributor guide
Research direction
Start with the linked iox/vector.hpp operation around lines 200-203, then inspect the other iox container APIs for bool-returning operations that may fail. Mark the applicable operations [[nodiscard]] and verify that existing callers handle or explicitly ignore their results; the issue does not name specific test files.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100