Skip to content

Fix uninitialized class/struct members in public headers#1735

Open
maxwbuckley wants to merge 1 commit intorapidsai:mainfrom
maxwbuckley:fix-uninitialized-members-pr
Open

Fix uninitialized class/struct members in public headers#1735
maxwbuckley wants to merge 1 commit 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
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 8ee22d9 to 1554e22 Compare January 31, 2026 10:06
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

Projects

Development

Successfully merging this pull request may close these issues.

2 participants