-
Notifications
You must be signed in to change notification settings - Fork 388
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
Mark iox container operations which return bool as [[nodiscard]] #2277
Labels
refactoring
Refactor code without adding features
Comments
pbarone-latai
added a commit
to pbarone-latai/iceoryx
that referenced
this issue
Apr 24, 2024
…/emplacing fails
21 tasks
pbarone-latai
added a commit
to pbarone-latai/iceoryx
that referenced
this issue
Apr 24, 2024
…/emplacing fails Signed-off-by: Patrick Barone <[email protected]>
@pbarone-latai we do not have objections but you might need to add quite a lot of |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 returnsbool
as compared tovoid
ofstd::vector::push_back
.iceoryx/iceoryx_hoofs/container/include/iox/vector.hpp
Lines 200 to 203 in f069696
Marking this code as
[[nodiscard]]
will raise compiler warnings in the event that a user is pushing back blindly onto aniox::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 ...If the iceoryx team is aligned with this approach, I can put up a PR to add the nodiscards
The text was updated successfully, but these errors were encountered: