std::libc::primitives
C Primitive Types
Raw C ABI type aliases used by std::libc.
Type Mapping
| C Type | Ignis Alias | Ignis Base | Size |
|---|---|---|---|
char |
CType::CChar |
u8 |
1 |
signed char |
CType::CSChar |
i8 |
1 |
unsigned char |
CType::CUChar |
u8 |
1 |
short |
CType::CShort |
i16 |
2 |
unsigned short |
CType::CUShort |
u16 |
2 |
int |
CType::CInt |
i32 |
4 |
unsigned int |
CType::CUInt |
u32 |
4 |
long |
CType::CLong |
i64 |
8 * |
unsigned long |
CType::CULong |
u64 |
8 * |
long long |
CType::CLongLong |
i64 |
8 |
unsigned long long |
CType::CULongLong |
u64 |
8 |
float |
CType::CFloat |
f32 |
4 |
double |
CType::CDouble |
f64 |
8 |
size_t |
CType::SizeT |
u64 |
8 |
ssize_t |
CType::SSizeT |
i64 |
8 |
ptrdiff_t |
CType::PtrDiffT |
i64 |
8 |
intptr_t |
CType::IntPtrT |
i64 |
8 |
uintptr_t |
CType::UIntPtrT |
u64 |
8 |
void* |
CType::CVoidPtr |
*mut void |
8 |
const void* |
CType::CConstVoidPtr |
*void |
8 |
char* |
CType::CStr |
*mut u8 |
8 |
const char* |
CType::CConstStr |
*u8 |
8 |
pid_t |
CType::PidT |
i32 |
4 |
uid_t |
CType::UidT |
u32 |
4 |
gid_t |
CType::GidT |
u32 |
4 |
off_t |
CType::OffT |
i64 |
8 |
mode_t |
CType::ModeT |
u32 |
4 |
dev_t |
CType::DevT |
u64 |
8 |
ino_t |
CType::InoT |
u64 |
8 |
nlink_t |
CType::NlinkT |
u64 |
8 |
blksize_t |
CType::BlkSizeT |
i64 |
8 |
blkcnt_t |
CType::BlkCntT |
i64 |
8 |
DIR* |
CType::DirPtr |
*mut void |
8 |
time_t |
CType::TimeT |
i64 |
8 |
clock_t |
CType::ClockT |
i64 |
8 |
(*) long is 8 bytes on LP64 (Linux/macOS 64-bit) but 4 bytes on LLP64
(Windows 64-bit). These aliases assume LP64.
Platform Assumption
Type sizes match LP64 targets (Linux/macOS 64-bit).
long-related aliases differ on LLP64 platforms.
Example
import CType from "std::libc/primitives";
function main(): i32 {
let n: CType::SizeT = 128;
let p: CType::CVoidPtr = null;
let ok: boolean = p == CType::NULL;
return ok ? (n as i32) : 0;
}
namespace CTypeRecords
record TimespecC struct timespec.
tvSec: i64tvNsec: i64Type aliases
type BlkCntT = i64C blkcnt_t (LP64, POSIX).
type BlkSizeT = i64C blksize_t (LP64, POSIX).
type CChar = u8C char (signedness is platform-defined).
type CConstStr = *u8C const char*.
type CConstVoidPtr = *voidC const void*.
type CDouble = f64C double.
type CFloat = f32C float.
type CInt = i32C int / signed int.
type ClockIdT = i32C clockid_t.
type ClockT = i64C clock_t.
type CLong = i64C long / signed long.
type CLongLong = i64C long long / signed long long.
type CSChar = i8C signed char.
type CShort = i16C short / signed short.
type CStr = *mut u8C char*.
type CUChar = u8C unsigned char.
type CUInt = u32C unsigned int.
type CULong = u64C unsigned long.
type CULongLong = u64C unsigned long long.
type CUShort = u16C unsigned short.
type CVoidPtr = *mut voidC void*.
type DevT = u64C dev_t (LP64, POSIX).
type DirPtr = *mut voidC DIR* (opaque, POSIX).
type FilePtr = *mut voidC FILE* (opaque).
type GidT = u32C gid_t (POSIX).
type InoT = u64C ino_t (LP64, POSIX).
type IntPtrT = i64C intptr_t.
type ModeT = u32C mode_t (POSIX).
type NlinkT = u64C nlink_t (LP64, POSIX).
type OffT = i64C off_t (POSIX).
type PidT = i32C pid_t (POSIX).
type PtrDiffT = i64C ptrdiff_t.
type SizeT = u64C size_t.
type SSizeT = i64C ssize_t.
type TimeT = i64C time_t.
type UidT = u32C uid_t (POSIX).
type UIntPtrT = u64C uintptr_t.
Constants
const NULL: *mut void