Fixed Width Integer Types And Compatibility Issues
C99 and current C++ version support some fixed width integer types like int64_t
and uint64_t
,
and provide some associated, portable printf
format specifiers like PRId64
.
The types are defined in <stdint.h>
, and the format specifiers are defined in <inttypes.h>
, which includes <stdint.h>
.
Some older build environments don't support these types, but provide some fixed width types
with proprietary names, and associated proprietary format specifiers to be used with printf
and friends,
and possibly even provide <stdint.h>
or <inttypes.h>
files which aren't compatible with the C99 standard.
- Here is an overview of the types, associated defines, and printf format specifiers:
Fixed width integer types (since C++11)
http://en.cppreference.com/w/cpp/types/integer
- A general overview of fundamental C/C++ data types:
Fundamental types
http://en.cppreference.com/w/cpp/language/types
Older versions of Microsoft or Borland compilers don't support the C99 fixed with types
Visual Studio 6:
LONGLONG
is__int64
and usesI64{d|i|o|u|x|X}
unsigned __int64
is not fully supported by the runtime library
Borland C++:
LONGLONG
is__int64
and usesI64{d|i|o|x|X}
or%Li
ULONGLONG
isunsigned __int64
and usesI64{o|u|x|X}
or%Lu
%L
is specific to Borland, so %I64
should be used preferably.
— Martin Burnicki 2016-04-26 14:39