Skip to content

Dead code: src/dedx_const.h is never included and its constants are unused #126

Description

@grzanka

Summary

src/dedx_const.h defines a set of physics constants but the header is not included by any translation unit, and none of the macros it defines are referenced anywhere in src/ or include/. It is effectively dead code.

Details

The header defines:

#define DEDX_N_AVO   6.0221367
#define DEDX_AMU     931.49432
#define DEDX_PI      3.14159265358979323846
#define DEDX_EMASS   0.51099906
#define DEDX_ECHARGE 1.60217733
#define DEDX_ECHARGE2 14.399652

Evidence:

  • grep -rln 'dedx_const.h' src include → matches only the file itself (no #include "dedx_const.h" anywhere).
  • grep -rn 'DEDX_N_AVO\|DEDX_AMU\|DEDX_EMASS\|DEDX_ECHARGE' src include (excluding the header itself) → no matches.

So either:

  1. The header is stale and should be removed, or
  2. These constants are duplicated as magic numbers in the .c files (Bethe / mpaul / mstar computations) and the intent was to centralize them here.

Suggested action

Confirm which case applies:

  • If the constants are unused → delete src/dedx_const.h.
  • If equivalent magic numbers exist in the .c files → wire the header in and replace the literals, so the constants live in one place.

Notes

This was found during a dependency-structure review of libdedx. The overall include graph is otherwise clean (no circular dependencies, consistent and unique include guards, good public/private header separation). A few other smaller items were noted separately (e.g. static const arrays defined in dedx_periodic_table.h); this issue is scoped to the dedx_const.h dead code only.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions