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

John Reagan via llvm-dev llvm-dev at lists.llvm.org
Wed Jun 12 14:01:04 PDT 2019


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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190612/7ecc6f56/attachment.sig>


More information about the llvm-dev mailing list