Skip to content

Avoid readability-avoid-const-params-in-decls? #1271

@MichaelChirico

Description

@MichaelChirico

Documentation:

https://clang.llvm.org/extra/clang-tidy/checks/readability/avoid-const-params-in-decls.html

Came across this in quanteda, e.g.

definition:

https://github.com/quanteda/quanteda/blob/db2466641c51c4c5de5a199d350550e3434946b4/src/tokens_select.cpp#L141-L149

declaration:

https://github.com/quanteda/quanteda/blob/db2466641c51c4c5de5a199d350550e3434946b4/src/RcppExports.cpp#L230

As noted in the docs, copying over such const qualifications is somewhat misleading since const doesn't do anything there. OTOH, there's a readability argument that having a 1-1 match of declaration+definition makes for easier maintenance.

There's also nothing wrong, per se, with copying over the const, so it may be more pain that it's worth to add logic to figure out whether const can be ignored in a given case (assuming no such logic is in place already).

But, I came across this, so I figured I'd file the issue. Feel free to close as out of scope.

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