[llvm-dev] [RFC] Coding Standards: "prefer `int` for regular arithmetic, use `unsigned` only for bitmask and when you intend to rely on wrapping behavior."

David Greene via llvm-dev llvm-dev at lists.llvm.org
Wed Jun 12 09:44:18 PDT 2019

Mehdi AMINI <joker.eph at gmail.com> writes:

> I agree that readability, maintainability, and ability to debug/find
> issues are key.  I haven't found myself in a situation where unsigned
> was helping my readability: on the opposite actually I am always
> wondering where is the expecting wrap-around behavior and that is one
> more thing I have to keep in mind when I read code that manipulate
> unsigned. So YMMV but using unsigned *increases* my mental load when
> reading code.

My experience is the same.  "unsigned" to me gives no useful information
and actually requires more mental thought to look for pitfalls.


More information about the llvm-dev mailing list