Skip to content

GCC sign_compare and reorder warning flags patches #233

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

Merged
merged 1 commit into from
Jul 15, 2020

Conversation

jwimberley
Copy link

In order to compile with -Werror=sign_compare and -Werror=reorder, a few small int -> size_t replacements and constructor initialization list.

@@ -26,7 +26,7 @@ namespace hnswlib {
}

HierarchicalNSW(SpaceInterface<dist_t> *s, size_t max_elements, size_t M = 16, size_t ef_construction = 200, size_t random_seed = 100) :
link_list_locks_(max_elements), element_levels_(max_elements), link_list_update_locks_(max_update_element_locks) {
link_list_locks_(max_elements), link_list_update_locks_(max_update_element_locks), element_levels_(max_elements) {
Copy link
Member

@yurymalkov yurymalkov Jul 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm. I wonder, why the order matters here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I the order only really matters pragmatically, for when a client (such as myself) needs to include hnswlib in a project that builds with the -Wall -Werror compiler flags by policy, in which case this won't compile. I doubt there's actually any problem in this particular case, and the warning is just a false positive, but https://stackoverflow.com/questions/1828037/whats-the-point-of-g-wreorder explains the justification for this GCC warning flag in general.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Thanks! Didn't know about this.

@yurymalkov yurymalkov changed the base branch from master to develop July 15, 2020 21:30
@yurymalkov yurymalkov merged commit ab012ae into nmslib:develop Jul 15, 2020
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