I was wondering where types like int64_t come from. Are they c++ standard or os-dependent? (1)
Also, do you know where I can find documentation about these types? I couldn't find useful information so far. Do they have a special name? (2)
What's their general difference with regards to the standard primitive types like int,long... (3)
Thank you and Regards
In a 64-bit compile, int64_t is long int , not a long long int (obviously).
A long on some systems is 32 bits (same as an integer), the int64_t is defined as a 64 bit integer on all systems (otherwise known as a long long). Portability may be affected using long, but using int64_t looks like it was created to increase portability.
int_fast64_t is the data type with at least 64 bits and the best arithmetic performance. It's there mainly for consistency with int_fast8_t and int_fast16_t , which on many machines will be 32 bits, not 8 or 16.
It comes from a header file:
#include <stdint.h>
// C standard library#include <cstdint>
// C++ standard library
int64_t is typedef you can find that in
<cstdint>
They were introduced by C99 standard.
Documentation:
http://www.cplusplus.com/reference/cstdint/
http://en.cppreference.com/w/c/types/integer
They were introduced because the standard doesn't specify fixed width for standard primitives, but a minimum width. So int
can be 16-bit or 32-bit, depending on compiler, OS, and architecture, long
varies as well as it can be 32-bit or 64-bit. Even char
can be 8 or 16 bits.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With