Skip to content

Add int types with a fixed size

Denys Smirnov requested to merge dennwc/cc:fixed_ints into master

This change adds support for builtin int types with a fixed size, similar to __int128:

  • __int8
  • __int16
  • __int32
  • __int64

Those int types are only defined by MSVC. As far as I know there is no builtin equivalent in GCC.

Note that those int types are sign-less, meaning that unsigned __int8 and signed __int8 are both valid.

The use case for supporting those in the CC is to support header files with no external dependencies (like stdint.h) which defines types with a fixed ints. Overriding the stdint.h itself is a good approximation of the use case.

Without this change it's required to change the header file text depending on the CC config to determine which of the defined builtin int types has the same size as the desired one.

Signed-off-by: Denys Smirnov dennwc@pm.me

Merge request reports