1 The `ffi.sizeof()` function queries the size of types or cdata instances 2 in bytes. 3 4 -- Testcase -- 5 {% 6 import * as ffi from 'ffi'; 7 8 ffi.cdef('struct point { int x; int y; };'); 9 10 print("int: ", ffi.sizeof('int'), "\n"); 11 print("double: ", ffi.sizeof('double'), "\n"); 12 print("point: ", ffi.sizeof('struct point'), "\n"); 13 14 let arr = ffi.ctype('int[10]'); 15 print("int[10]: ", ffi.sizeof(arr), "\n"); 16 -- End -- 17 18 -- Expect stdout -- 19 int: 4 20 double: 8 21 point: 8 22 int[10]: 40 23 -- End -- 24
This page was automatically generated by LXR 0.3.1. • OpenWrt