diff options
author | Sven Göthel <[email protected]> | 2024-05-03 17:05:38 +0200 |
---|---|---|
committer | Sven Göthel <[email protected]> | 2024-05-03 17:05:38 +0200 |
commit | 18d2e004a17a9ecc4ffc2b511e1ed287c85b28c0 (patch) | |
tree | d7c8dfa7764a68ba52f6efb02c13bc2b7c9bab18 /src/lesson02a_arithmetic.cpp | |
parent | c965ba96c0c714e1a84902c71f3e8aa7da020b6a (diff) |
Resolve clang-tidy warnings=error; Notable std::vector<>: size() -> size_t (unsigned) but iterator and difference_type are signed and losing half of range
Because std::vector<>::begin() iterator performs arithmetic
using a signed difference_type, we need to use such a signed type
here to avoid `bugprone-narrowing-conversions` (LINT)
Now, isn't this odd as std::vector<>::size() uses unsigned size_type,
aka size_t and mentioned iterator hence lose half the value range possible?
Diffstat (limited to 'src/lesson02a_arithmetic.cpp')
-rw-r--r-- | src/lesson02a_arithmetic.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/lesson02a_arithmetic.cpp b/src/lesson02a_arithmetic.cpp index 2009b77..e83eb88 100644 --- a/src/lesson02a_arithmetic.cpp +++ b/src/lesson02a_arithmetic.cpp @@ -91,6 +91,7 @@ float machineEpsilon() { // std::cerr << i << ": " << res << " -> " << x << std::endl; ++i; } while ( one + x > one ); + (void)i; return res; } |