README (1526B)
1 types::c provides type aliases that are compatible with standard C builtin types 2 and typedefs, as specified ISO/IEC 9899 and POSIX, as well as convenience 3 functions for working with C types. This module is useful for C interop, for 4 instance if an external function returns a [[long]] or a [[ssize]], or if you 5 need to convert between a C string and a Hare string. The types provided here 6 shouldn't be used for most Hare code. 7 8 Some C types aren't provided by this module, since they are provided by the Hare 9 language itself: 10 11 - _Bool, bool -> bool 12 - nullptr_t -> null 13 - (signed) int -> int 14 - size_t -> size 15 - unsigned int -> uint 16 - uintptr_t -> uintptr 17 - va_list -> valist 18 19 Some C types are mostly compatible with Hare types, with minor differences: 20 21 - C's void is an incomplete opaque type, which is also used to indicate the 22 absence of a value. Hare provides void as a zero-size type, and opaque as an 23 undefined-size opaque type. 24 - Hare doesn't have builtin imaginary or complex types, though complex types 25 with equivalent represention to their C counterparts are declared in 26 [[math::complex::]]. Hare doesn't allow casting between real and complex types 27 like C does. 28 29 Hare doesn't support bit-precise integer types (_BitInt) or decimal floating 30 point types (_Decimal32, _Decimal64, _Decimal128). Hare also doesn't provide any 31 floating point type larger than 8 bytes, implicating `long double` on some 32 platforms. 33 34 Additional low-level or implementation-specific types may be defined in 35 [[rt::]].