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

Update MPMCQueue.h and add [[nodiscard]] attributes to emty(), idx(), turn(), size() #34

Closed
wants to merge 3 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Dec 13, 2021

Add [[nodiscard]] attributes

Add [[nodiscard]]
@rigtorp
Copy link
Owner

rigtorp commented Dec 14, 2021

Nice, I was going to add this myself. The question is if I should bump the required C++ standard to C++17 which includes [[nodiscard]] or use macros to support C++11.

@ghost
Copy link
Author

ghost commented Dec 14, 2021

I was under the impression that unknown attributes are ignored by major compilers. After some research it turns out this is a c++ 17 feature. Macros are better suited then.

@rigtorp
Copy link
Owner

rigtorp commented Dec 14, 2021

This approach seems to work well rigtorp/SPSCQueue#31

@ghost
Copy link
Author

ghost commented Dec 15, 2021

Done.
Also, if not too persnickety, I see no reason to #include a pure C header <stdlib.h> instead of <cstdlib>, especially as the other two C headers (cassert, cstddef) were included that way.

@rigtorp
Copy link
Owner

rigtorp commented Dec 20, 2021

Done. Also, if not too persnickety, I see no reason to #include a pure C header <stdlib.h> instead of , especially as the other two C headers (cassert, cstddef) were included that way.

Yes I agree.

Shouldn't try_pop, try_push etc also have NODISCARD?

@ghost ghost closed this by deleting the head repository Dec 17, 2022
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants