OxL Reference

fn sizeOf

sizeof(T) in bytes with C layout rules.

Example:

oxl✓ checked in CI
use std.ffi { sizeOf }

@c_layout
data Mixed {
  tag: u8
  count: i32
  ratio: f64
}

fn main() io {
  print("{sizeOf<Mixed>()} {sizeOf<i32>()}")
}
Output
16 4
@intrinsic("ffi.sizeOf") pub(api) fn sizeOf<T>() -> usize

Since. 1.0.0-beta

Returns

usize

Effects

none declared (pure unless the body says otherwise)

Defined in: std/ffi/ffi.oxl:246

See also