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
implicit signed/unsigned conversion and truncations #11
Comments
Thanks for reporting!
I can't work right now on trying it, but if you can and are satisfied with the result, please feel free to open another PR! |
Acutally what you might want to do is have the dimension type of the same type as the IndexType points to. Your last template paramter intends to leave that choice of which type holds your indices to the user, then you should for the dimension also really leave it to the user. |
It is a mistake to use unsigned integers for indices (and therefore for sizes because of mixing signed/unsigned types), see nanoflann provides adaptors for Eigen classes, so for example the default index type of Eigen for dense matrices is |
@vladimir-ch Thanks for the interesting discussion from the C++ gurus! |
Fixed after 7011ba3. |
The code is littered with problematic conversions from unsigned to signed integers and truncations, because size_t has 64 bit length and int hasn't.
Some of them are issues due to the fact that the Template parameter IndexType is not used where it ought to be, this is relative easy to fix (await pull request).
But a big problem here is that the Dimension is of type int instead of type IndexType, so if you set IndexType to size_t and have a int dimension you will get buried in hundreds of warnings.
Solutiuon would be to change the Template argument order and make the dim paramter of type IndexSize, but this is a serious Interface change and needs disuccion.
Any ideas how to fix this?
The text was updated successfully, but these errors were encountered: