Ray's Knowledge Base

Which (void) casts may stay in dftracer-utils

DecisionVerified 27 Sep 2026Holds project: dftracer-utils
Decision. The context, the choice, why, and the options that were turned down.

Context#

Stage 11 (void-casts, 2026-09-27) cut the C++ (void) casts from 121 to 3. The build uses -Wall -Wextra -Wunused.

Decision#

A new (void) cast in C++ is allowed only for:

  • a call whose result the compiler marks as must-use, made only for its throw or side effect (today: simdjson element::get, which is warn_unused_result);
  • release() of a smart pointer whose ownership moved elsewhere (core/tasks/coro_scope.h).

Everything else takes another form: an unnamed parameter for a fixed signature, a removed parameter or local when nothing needs it, [[maybe_unused]] for a name used only under #ifdef or assert, and BinaryReader::skip(n) for bytes a reader passes over. The C plugin sources under tests/utilities/plugins/*.c keep (void)param;, because C17 has no unnamed parameters.

Why#

The repo declares no [[nodiscard]] anywhere in include/ or src/ (rg -c nodiscard include src finds nothing). A cast on a first-party call, such as inside CHECK_THROWS_AS((void)df.mask(q), ...), silences nothing, and a cast on a name hides a parameter or a local that should not exist. The cleanup found dead parameters in dftracer_stats.cpp and a CLI flag, dftracer_view --stream, that did nothing.

Rejected options#

  • A CTest that greps for casts: the project rules reject tests of source text.

Evidence#

  • Commit 3265e43 on feat/extensible-index: 56 files, 0 new warnings on the tests and release presets, plugin ABI fingerprint 0x89F9686C unchanged, C++ 285/285 and Python 1131 passed.