[PATCH] D71607: [clang-tidy] Add unsigned subtraction warning, with suggestion to convert to unsigned literals.

Jeffrey Sorensen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 29 14:35:41 PST 2020


sorenj added a comment.

My colleague pointed out that -Wsigned-conversion will not detect this very frequent mistake

  for (size_t i = 0; i < v.size() - 1; ++i)

It is my contention, and I think it's pretty well substantiated by reviewing cases where this detector fails that no coder ever really expects to subtract a signed value from an unsigned value.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71607/new/

https://reviews.llvm.org/D71607





More information about the cfe-commits mailing list