Skip to content

cleanup: drop using-namespace-std from public headers, enable BigInteger moves, complete tuner emitter#124

Merged
mmurshed merged 2 commits into
mainfrom
cleanup/header-hygiene
Jun 12, 2026
Merged

cleanup: drop using-namespace-std from public headers, enable BigInteger moves, complete tuner emitter#124
mmurshed merged 2 commits into
mainfrom
cleanup/header-hygiene

Conversation

@mmurshed

Copy link
Copy Markdown
Owner

Summary

Fixes audit recommendation (c) — final piece of the audit follow-up series (#121 tests, #122 squaring, #123 dedups):

  1. using namespace std; removed from all 17 public headers, std names qualified explicitly. The root header injected std into every consumer TU at global scope — interop hazard, classic source of ambiguous overloads. App/test .cpp files keep their own local using-directives.
  2. BigInteger rule of five, all defaulted. The hand-written copy ctor/dtor/copy-assign (byte-identical to the compiler-generated ones) suppressed implicit moves, so std::move(BigInteger) deep-copied the limb vector — including the q/r moves in division paths. Verified by data-pointer-transfer probe.
  3. dispatch_tuner --emit-header completed: now emits the 21 post-2026-06 division band macros (RATIO20/RATIO2/RATIO35/MID/BALANCED, QSIZED_MAIN/SMALL, BZ_RECURSION, CYCLIC_NTT) so regenerated platform profiles keep the full band set. Pass-through values, explicitly commented as not-auto-tuned (division_floor_probe remains the manual sweep tool).
  4. Last 3 CRLF files normalized — repo is now uniformly LF. (Some headers in this diff show as full-file rewrites for that reason; git diff -w is the readable view.)

Test plan

  • All CMake targets build (library, tests, benches, calculator)
  • ctest 4/4 (unit_tests 280, mfa_roundtrip), mult_correctness + div_correctness full matrices
  • GMP division dispatch fuzz, 300 adversarial cases
  • Move-semantics probe: limb-vector data pointer transfers through move-ctor and move-assign
  • divperf_simple unchanged
  • grep -r "using namespace std" include/ → 0

🤖 Generated with Claude Code

mmurshed and others added 2 commits June 12, 2026 14:31
…plete tuner emitter

- Remove `using namespace std;` from all 17 public headers and qualify
  std names explicitly. The root header injected the entire std namespace
  into every consumer translation unit — a real interop hazard for any
  downstream code with its own `vector`/`min`/`copy` and a known source
  of ambiguous-overload breakage. App/test .cpp files keep their own
  local using-directives.

- BigInteger: rule of five, all defaulted. The user-declared copy
  ctor/dtor/copy-assign (identical to the compiler-generated ones)
  suppressed the implicit move operations, so std::move(BigInteger)
  deep-copied the limb vector everywhere — including the q/r moves in
  the division paths. Verified by data-pointer-transfer probe.

- dispatch_tuner --emit-header now carries the 21 post-2026-06 division
  band macros (NEWTON_RATIO20/RATIO2/RATIO35/MID/BALANCED, QSIZED_MAIN/
  SMALL, BZ_RECURSION, CYCLIC_NTT) so a regenerated platform profile
  keeps the complete band set instead of silently dropping the new
  bands. They pass through the build's values and are marked not-auto-
  tuned; division_floor_probe remains the manual sweep tool.

- Normalize the last 3 CRLF files (Shift.h, Builder.h, Constants.h);
  the repo is now uniformly LF. (Several headers in this diff show as
  full-file rewrites for the same reason.)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mmurshed mmurshed merged commit fd2d6a6 into main Jun 12, 2026
4 of 5 checks passed
@mmurshed mmurshed deleted the cleanup/header-hygiene branch June 12, 2026 21:35
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.

1 participant