-
Notifications
You must be signed in to change notification settings - Fork 6
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
MSVC warnings #20
Comments
@tnagler Should we use |
As far as I can see, arguments of
Best way I see to "fix" this is to |
Isn't According to #include <atomic>
#include <iostream>
int main() {
std::atomic_size_t size;
std::cout << "is_lock_free(): " << size.is_lock_free() << std::endl;
std::cout << "is_always_lock_free: " << size.is_always_lock_free << std::endl;
return 0;
}
|
Yes but the loop algorithm relies on: Lines 260 to 264 in 0a6b243
This struct as a whole still allows for lock-free atomic operations. This is checked at the beginning of the unit tests: Lines 9 to 11 in 0a6b243
If you replace int by a larger type that's no longer the case.
|
Oh, I see. In that case I propose to use |
Well that changes the functionality of the library, because loop ranges can no longer run over negative indexes. That isn't an issue in 99% of the cases, but it is a limitation. Unfortunately there's a trade-off here that we cannot avoid easily. I personally don't really mind the warning about a possible narrowing conversion, because it does what it should - make a user aware of a potential, but unlikely bug in their code. It's the user's responsibility to turn such warnings on when there's a possibility that the loop range runs over billions of indexes. Making that bug impossible would be better of course. One could keep the functionality and make it "safe" by 1) accepting An extension of the above that resolves the downsides would be to 1) allow |
Sounds good, let's stick to fixed integer types though ( |
From https://github.com/tnagler/quickpool/runs/5404950620:
The text was updated successfully, but these errors were encountered: