5

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

ben
  • 5,671
  • 4
  • 27
  • 55

3 Answers3

5

It comes from a header file:

#include <stdint.h> // C standard library
#include <cstdint> // C++ standard library

egur
  • 7,830
  • 2
  • 27
  • 47
4

int64_t is typedef you can find that in

   <cstdint>
user3134167
  • 375
  • 1
  • 2
  • 10
3

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.

bolov
  • 72,283
  • 15
  • 145
  • 224