[PATCH] D39263: [support] remove tautological comparison in Support/Windows/Path.inc
Reid Kleckner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 25 08:54:59 PDT 2017
rnk added inline comments.
================
Comment at: llvm/lib/Support/Windows/Path.inc:726
- if (Size > std::numeric_limits<SIZE_T>::max())
- return make_error_code(errc::invalid_argument);
-
----------------
amccarth wrote:
> I assume someone was originally worried that `SIZE_T` would be 32 bits wide in a 32-bit build but somehow believed `std::size_t` (which is the type of Size) could still somehow be larger than that. Ain't gonna happen.
I wonder if we should turn these examples of dynamic range checks into static_asserts. We saw a lot of these tautological comparison warnings in Chrome, where it was much less obvious that the types are the same size. Would this be an appropriate replacement for the check?
static_assert(std::numeric_limits<decltype(Size)>::max() <=
std::numeric_limits<SIZE_T>::max());
https://reviews.llvm.org/D39263
More information about the llvm-commits
mailing list