1

Google styleguide suggests to use int64_t when value is "greater than or equal to 2^31", but according to standard it is optional, so wouldn't it be better to use int_least64_t? What benefits of use int64_t besides shorter name?

1 Answers1

2

int64_t has a known size, int_least64_t might be larger than 64-bits. Dealing with a data type with a known size is much easier than one that might be bigger and introduce subtle bugs on platforms where int_least64_t is not 64-bits.

I'm not aware of a platform that google is likely to be targetting that doesn't support 64-bit integers.

Alan Birtles
  • 32,622
  • 4
  • 31
  • 60
  • Is there any platforms at all, which has a C++11 compiler, and don't support `int64_t`? – geza Jul 30 '18 at 07:12
  • @geza I wouldn't be surprised if there is, something like an embedded system that only supports 32-bit maths. – Alan Birtles Jul 30 '18 at 09:16
  • I've just asked about this: https://stackoverflow.com/questions/51590607/are-there-any-platforms-where-fixed-width-types-intxx-t-are-missing. Note, however, the compiler has to give an at-least-64-bit types, because `long long` has to be at least 64-bit. – geza Jul 30 '18 at 09:18