Module

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 CType

Records

record Timespec

C struct timespec.

Members
tvSec: i64
tvNsec: i64

Type aliases

type BlkCntT = i64

C blkcnt_t (LP64, POSIX).

type BlkSizeT = i64

C blksize_t (LP64, POSIX).

type CChar = u8

C char (signedness is platform-defined).

type CConstStr = *u8

C const char*.

type CConstVoidPtr = *void

C const void*.

type CDouble = f64

C double.

type CFloat = f32

C float.

type CInt = i32

C int / signed int.

type ClockIdT = i32

C clockid_t.

type ClockT = i64

C clock_t.

type CLong = i64

C long / signed long.

type CLongLong = i64

C long long / signed long long.

type CSChar = i8

C signed char.

type CShort = i16

C short / signed short.

type CStr = *mut u8

C char*.

type CUChar = u8

C unsigned char.

type CUInt = u32

C unsigned int.

type CULong = u64

C unsigned long.

type CULongLong = u64

C unsigned long long.

type CUShort = u16

C unsigned short.

type CVoidPtr = *mut void

C void*.

type DevT = u64

C dev_t (LP64, POSIX).

type DirPtr = *mut void

C DIR* (opaque, POSIX).

type FilePtr = *mut void

C FILE* (opaque).

type GidT = u32

C gid_t (POSIX).

type InoT = u64

C ino_t (LP64, POSIX).

type IntPtrT = i64

C intptr_t.

type ModeT = u32

C mode_t (POSIX).

type NlinkT = u64

C nlink_t (LP64, POSIX).

type OffT = i64

C off_t (POSIX).

type PidT = i32

C pid_t (POSIX).

type PtrDiffT = i64

C ptrdiff_t.

type SizeT = u64

C size_t.

type SSizeT = i64

C ssize_t.

type TimeT = i64

C time_t.

type UidT = u32

C uid_t (POSIX).

type UIntPtrT = u64

C uintptr_t.

Constants

const NULL: *mut void