[llvm-dev] [RFC] Coding Standards: "prefer `int` for regular arithmetic, use `unsigned` only for bitmask and when you intend to rely on wrapping behavior."
Michael Kruse via llvm-dev
llvm-dev at lists.llvm.org
Mon Jun 10 09:24:57 PDT 2019
Am Sa., 8. Juni 2019 um 13:12 Uhr schrieb Tim Northover via llvm-dev
<llvm-dev at lists.llvm.org>:
> I'd prefer us to have something neater than static_cast<int> for the
> loop problem before we made that change. Perhaps add an ssize (or
> equivalent) method to all of our internal data structures? They're a
> lot more common than std::* containers.
Since C++20 is also introducing ssize  members, this makes a lot of
sense to me. Using it would help avoiding an unsigned comparison as in
if (IndexOfInterestingElement >= Container.size())
to sneak in from the start.
More information about the llvm-dev