[PATCH] D52892: [Clang-tidy] readability check to convert numerical constants to std::numeric_limits

Jonas Toth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 12 07:03:49 PDT 2018


JonasToth added a comment.

In https://reviews.llvm.org/D52892#1263324, @aaron.ballman wrote:

> I like the thrust of this check, but we already have the readability-magic-numbers check and I think that this functionality would fit naturally there. That check finds numerical constants and recommends turning them into named constants, but for special values it seems reasonable to recommend using `numeric_limits` instead. What do others think of that, from an organizational perspective?


+1, totally forgot that one. I feel that the bugprone is more strict though, so adding an `readability`-mode for it that only warns for the `numeric_limits` constants seems desirable.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D52892





More information about the cfe-commits mailing list