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

JF Bastien via llvm-dev llvm-dev at lists.llvm.org
Thu Jun 13 09:00:06 PDT 2019



> On Jun 12, 2019, at 2:01 PM, John Reagan via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> On Tue, Jun 11, 2019 at 12:26 PM Michael Kruse <llvmdev at meinersbur.de>
> wrote:
> 
> vector.size() returns a size_t, which on 64-bit platforms can represent
> types values larger than those that can fit into an int64_t.  So to turn
> your argument around, since it's theoretically possible to have a vector
> with more items than an int64_t can represent, isn't it already worth it
> to use size_t, which is an unsigned type?
> 
> 
> That's not true on my platform.  I have 64-bit pointers so intptr_t is
> 64-bits, but the largest thing you can allocate is only 32-bits big so
> size_t (and ptrdiff_t) are 32-bits.

It runs LLVM?


More information about the llvm-dev mailing list