tipps:fixed_width_integer_types

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.

Older versions of Microsoft or Borland compilers don't support the C99 fixed with types

Visual Studio 6:

  • LONGLONG is __int64 and uses I64{d|i|o|u|x|X}
  • unsigned __int64 is not fully supported by the runtime library

Borland C++:

  • LONGLONG is __int64 and uses I64{d|i|o|x|X} or %Li
  • ULONGLONG is unsigned __int64 and uses I64{o|u|x|X} or %Lu

%L is specific to Borland, so %I64 should be used preferably.


Martin Burnicki 2016-04-26 14:39

  • tipps/fixed_width_integer_types.txt
  • Zuletzt geändert: 2021-08-27 10:46
  • von martin