Fix uninitialized class/struct members in public headers#1735
Open
maxwbuckley wants to merge 1 commit intorapidsai:mainfrom
Open
Fix uninitialized class/struct members in public headers#1735maxwbuckley wants to merge 1 commit intorapidsai:mainfrom
maxwbuckley wants to merge 1 commit intorapidsai:mainfrom
Conversation
Initialize POD members with sensible defaults to prevent undefined behavior when users create instances without explicitly setting all fields: - cluster/agglomerative.hpp: min_samples = 5 - distance/distance.hpp: KernelParams defaults (LINEAR, degree=3, gamma=1.0, coef0=0.0) - distance/grammian.hpp: cublas_handle = nullptr, fix empty constructor syntax - neighbors/ball_cover.hpp: index_trained = false - neighbors/common.hpp: make base_filter destructor virtual, num_ranks_ = 0 - neighbors/hnsw.hpp: ef = 200 - neighbors/vamana.hpp: pq_codebook_size = 0, pq_dim = 0 - preprocessing/spectral_embedding.hpp: n_components=2, n_neighbors=15, etc. Also fixes base_filter to have a virtual destructor for safe polymorphic deletion. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
8ee22d9 to
1554e22
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
base_filterto have a virtual destructor for safe polymorphic deletion{};→{}) and use= defaultfor trivial destructorsFiles Changed
cluster/agglomerative.hppmin_samples = 5distance/distance.hppKernelParams:kernel = LINEAR,degree = 3,gamma = 1.0,coef0 = 0.0distance/grammian.hppcublas_handle = nullptr, constructor/destructor cleanupneighbors/ball_cover.hppindex_trained = falseneighbors/common.hppvirtual ~base_filter(),num_ranks_ = 0neighbors/hnsw.hppef = 200neighbors/vamana.hpppq_codebook_size = 0,pq_dim = 0preprocessing/spectral_embedding.hppn_components = 2,n_neighbors = 15,norm_laplacian = true,drop_first = trueTest plan
🤖 Generated with Claude Code