• source navigation  • diff markup  • identifier search  • freetext search  • 

Sources/ucode/tests/custom/17_lib_ffi/05_alignof

  1 The `ffi.alignof()` function queries the alignment requirement of types
  2 in bytes. Struct alignment is determined by its most strictly aligned member.
  3 
  4 -- Testcase --
  5 {%
  6 import * as ffi from 'ffi';
  7 
  8 ffi.cdef('struct aligned { char c; int i; double d; };');
  9 
 10 print("char: ", ffi.alignof('char'), "\n");
 11 print("int: ", ffi.alignof('int'), "\n");
 12 print("double: ", ffi.alignof('double'), "\n");
 13 print("struct aligned: ", ffi.alignof('struct aligned'), "\n");
 14 -- End --
 15 
 16 -- Expect stdout --
 17 char: 1
 18 int: 4
 19 double: 8
 20 struct aligned: 4
 21 -- End --
 22 

This page was automatically generated by LXR 0.3.1.  •  OpenWrt