user8044236
user8044236

Reputation:

Why google styleguide suggests to use optional int64_t by default for big integers?

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?

Upvotes: 1

Views: 243

Answers (1)

Alan Birtles
Alan Birtles

Reputation: 36469

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.

Upvotes: 2

Related Questions