2020-10-30

data types

  • types can be understood as space requirement and associated semantics
  • for example, an unsigned integer type and a pointer might store identical bits, but pointers increment in address step sizes
  • the standard types int, char, and more have a platform dependent variable size with a minimum required size. type prefixes (long, long long, short, short short) are used to specify different minimum size requirements. c data types on wikipedia
  • there are also standard fixed size data types that are usually defined in stdint.h and included with inttypes.h. for example int32_t, uint8_t and more. they dont take strange type prefixes. inttypes.h also defines minimum size and maximum size limited types (int_least32_t, intmax_t, etc) as well as a fast type which is guaranteed to be the fastest available type on a platform with a minimum size

shorter type names

here are some alternative type names that could be used:

i8 i16 i32 i64 i8-least i16-least i32-least i64-least
i8-fast i16-fast i32-fast i64-fast u8 u16 u32 u64 u8
u16-least u32-least u64-least u8-fast u16-fast u32-fast
u64-fast f32 float f64 double pointer boolean

the rust language chose some of the same type names