Skip to content
Tetralux edited this page Aug 21, 2020 · 15 revisions

Index

  • builtin
  • c
  • container
  • dynlib
  • encoding
  • fmt
  • hash
  • intrinsics
  • log
  • math
  • mem
  • odin
  • os
  • path
  • reflect
  • runtime
  • sort
  • strconv
  • strings
  • sync
  • thread
  • time
  • unicode

Builtin

Core Odin procs that are available to use without any imports.

Platform constants

ODIN_OS

Current compiler platform os. "windows" "darwin" (MacOS) "linux"

ODIN_ARCH

ODIN_ENDIAN

The endianness of the target system. "little" or "big".

ODIN_VENDOR

ODIN_VERSION

ODIN_ROOT

ODIN_DEBUG

A boolean indicating whether debug information was requested on the command line. (-debug was passed.)

Types

byte

Alias for u8.

Useful if you want to indicate that the u8 is being used as data instead of a number.

Boolean

bool

8-bit boolean type.

b8

8-bit boolean type.

b16

16-bit boolean type.

b32

32-bit boolean type.

b64

64-bit boolean type.

Integer

i8

8-bit signed integer.

u8

8-bit unsigned integer.

i16

16-bit signed integer.

u16

16-bit unsigned integer.

i32

32-bit signed integer.

u32

32-bit unsigned integer.

i64

64-bit signed integer.

u64

64-bit unsigned integer.

i128

128-bit signed integer.

u128

128-bit unsigned integer.

rune

32-bit unicode codepoint.

Floating Point

f32

32-bit floating point number.

f64

64-bit floating point number.

Complex

complex32

complex64

complex128

quaternion128

quaternion256

int

Word-sized signed integer.

Not to be confused with C's int.

uint

Word-sized unsigned integer.

Not to be confused with C's unsigned int.

uintptr

Unsigned integer of pointer size.

rawptr

Pointer to memory address. Same function as void * in c. Prefer ^T where possible in odin.

Any other pointer type will implicitly cast to rawptr.

string

UTF-8 encoded string.

cstring

C style string with null terminator \0

any

Contains a pointer and a typeid describing the type of the thing it is pointing to.

typeid

A unique ID for a type.

Endian Specific Types

i16le

u16le

i32le

u32le

f32le

f32be

i64le

u64le

f64le

f64be

i128le

u128le

i16be

u16be

i32be

u32be

i64be

u64be

i128be

u128be

Procedures

len :: proc(array: Array_Type) -> int ---

cap :: proc(array: Array_Type) -> int ---

size_of :: proc($T: typeid) -> int ---

align_of :: proc($T: typeid) -> int ---

offset_of :: proc($T: typeid) -> uintptr ---

type_of :: proc(x: expr) -> type ---

type_info_of :: proc($T: typeid) -> ^runtime.Type_Info ---

typeid_of :: proc($T: typeid) -> typeid ---

swizzle :: proc(x: [N]T, indices: ..int) -> [len(indices)]T ---

complex :: proc(real, imag: Float) -> Complex_Type ---

quaternion :: proc(real, imag, jmag, kmag: Float) -> Quaternion_Type ---

real :: proc(value: Complex_Or_Quaternion) -> Float ---

imag :: proc(value: Complex_Or_Quaternion) -> Float ---

jmag :: proc(value: Quaternion) -> Float ---

kmag :: proc(value: Quaternion) -> Float ---

conj :: proc(value: Complex_Or_Quaternion) -> Complex_Or_Quaternion ---

expand_to_tuple :: proc(value: Struct_Or_Array) -> (A, B, C, ...) ---

min :: proc(values: ..T) -> T ---

max :: proc(values: ..T) -> T ---

abs :: proc(value: T) -> T ---

clamp :: proc(value, minimum, maximum: T) -> T ---

C

Types for interfacing for foreign c functions

CHAR_BIT

bool

char

byte

schar

uchar

short

ushort

int

uint

long

i32 on all windows systems or when platform is 32 bit

i64 on all other 64 bit platforms

ulong

u32 on all windows systems or when platform is 32 bit

u64 on all other 64 bit platforms

longlong

ulonglong

float

double

complex_float

complex_double

size_t

ssize_t

ptrdiff_t

uintptr_t

intptr_t

wchar_t

u16 on windows

u32 on all other platforms

Clone this wiki locally