Skip to content

Fix uninitialized class/struct members in public headers#1735

Closed
maxwbuckley wants to merge 4 commits intorapidsai:mainfrom
maxwbuckley:fix-uninitialized-members-pr
Closed

Fix uninitialized class/struct members in public headers#1735
maxwbuckley wants to merge 4 commits intorapidsai:mainfrom
maxwbuckley:fix-uninitialized-members-pr

Conversation

@maxwbuckley
Copy link
Contributor

Summary

  • Initialize POD members with sensible defaults to prevent undefined behavior when users create instances without explicitly setting all fields
  • Fix base_filter to have a virtual destructor for safe polymorphic deletion
  • Clean up empty constructor syntax ({};{}) and use = default for trivial destructors

Files Changed

File Changes
cluster/agglomerative.hpp min_samples = 5
distance/distance.hpp KernelParams: kernel = LINEAR, degree = 3, gamma = 1.0, coef0 = 0.0
distance/grammian.hpp cublas_handle = nullptr, constructor/destructor cleanup
neighbors/ball_cover.hpp index_trained = false
neighbors/common.hpp virtual ~base_filter(), 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, norm_laplacian = true, drop_first = true

Test plan

  • Verify existing tests pass (no behavioral change expected for code that explicitly sets these fields)
  • Confirm default values are reasonable based on existing documentation/usage patterns

🤖 Generated with Claude Code

@copy-pr-bot
Copy link

copy-pr-bot bot commented Jan 26, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@cjnolet cjnolet added improvement Improves an existing functionality non-breaking Introduces a non-breaking change labels Jan 29, 2026
@maxwbuckley maxwbuckley force-pushed the fix-uninitialized-members-pr branch from 8ee22d9 to 1554e22 Compare January 31, 2026 10:06
@cjnolet
Copy link
Member

cjnolet commented Feb 7, 2026

/ok to test 01994a4

@cjnolet
Copy link
Member

cjnolet commented Feb 7, 2026

/merge

@cjnolet
Copy link
Member

cjnolet commented Feb 10, 2026

/ok to test 9fd9475

@aamijar
Copy link
Member

aamijar commented Feb 12, 2026

/ok to test 5660eec

@aamijar
Copy link
Member

aamijar commented Feb 12, 2026

/ok to test 6811fcf

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>
@maxwbuckley maxwbuckley force-pushed the fix-uninitialized-members-pr branch from 6811fcf to 034f377 Compare February 14, 2026 20:09
@maxwbuckley
Copy link
Contributor Author

Rebased onto latest main to pick up the merge barrier commit. Could someone run /ok to test 034f377 when you get a chance? Thanks!

@aamijar
Copy link
Member

aamijar commented Feb 14, 2026

/ok to test 034f377

@aamijar
Copy link
Member

aamijar commented Feb 23, 2026

/ok to test 986dd69

@rapidsai rapidsai deleted a comment from copy-pr-bot bot Mar 3, 2026
@lowener
Copy link
Contributor

lowener commented Mar 3, 2026

/ok to test 1e1524a

@maxwbuckley
Copy link
Contributor Author

This got accidentally closed when I made my fork private (prototyping something awesome for a paper). Sorry about that will send a new one

@maxwbuckley
Copy link
Contributor Author

At first I was wondering how on earth I did this....

#1922 is the replacement

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Improves an existing functionality non-breaking Introduces a non-breaking change

Development

Successfully merging this pull request may close these issues.

4 participants