3 ms·
Yes, it is the type of thing caught by a linter or strict compilation rules. https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines-narrowing-convers
by kllrnohj 5y ago
Yes, it is the type of thing caught by a linter or strict compilation rules.
https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines-narrowing-conversions.html https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidel...
But strict compilation rules (eg, clang's -Weverything) mainly only work if you treat them as errors (so -Werror), and then some of those strict are then also questionable at best, and just outright annoyingly wrong at worst. For example, unused parameter warnings on virtual methods are a waste of time to deal with. It's not a symptom of a bug most of the time, so it being an error just generates workaround churn or you end up just disabling the warning and then maybe that bites you the few times it would have pointed out an actual issue.
Beyond the blanket ones like clang's -Weverything, it can otherwise be a job to keep up with compiler upgrades and the vast number of warning options they have.
- heavenlyblue 5y ago> For example, unused parameter warnings on virtual methods are a waste of time to deal with. Why is that even a warning? If at least one of the implementers use a parameter and a warning is shown the warning itself is wrong. That’s just broken implementation of the warning?