From 4d9c29a78cde2596ea3286744d93d29dd2a6d9ca Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Tue, 17 Jul 2012 22:20:03 +0200 Subject: FFI: Box all accessed or returned enums. --- doc/ext_ffi_semantics.html | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'doc/ext_ffi_semantics.html') diff --git a/doc/ext_ffi_semantics.html b/doc/ext_ffi_semantics.html index ed32d23f..afe7e613 100644 --- a/doc/ext_ffi_semantics.html +++ b/doc/ext_ffi_semantics.html @@ -250,19 +250,20 @@ constant values; retrieving return values from C calls: bool0 → false, otherwise trueboolean -Complex numberboxed valuecomplex cdata +enumboxed valueenum cdata -Vectorboxed valuevector cdata +Complex numberboxed valuecomplex cdata +Vectorboxed valuevector cdata + Pointerboxed valuepointer cdata - + Arrayboxed referencereference cdata - + struct/unionboxed referencereference cdata

-Bitfields or enum types are treated like their underlying -type. +Bitfields are treated like their underlying type.

Reference types are dereferenced before a conversion can take @@ -715,6 +716,10 @@ is performed. Otherwise both sides are converted to an int64_t and a signed arithmetic operation is performed. The result is a boxed 64 bit cdata object.
+If one of the operands is an enum and the other operand is a +string, the string is converted to the value of a matching enum +constant before the above conversion.
+ These rules ensure that 64 bit integers are "sticky". Any expression involving at least one 64 bit integer operand results in another one. The undefined cases for the division, modulo and power @@ -740,7 +745,11 @@ cdata number and a Lua number can be compared with each other. If one of them is an uint64_t, the other side is converted to an uint64_t and an unsigned comparison is performed. Otherwise both sides are converted to an int64_t and a signed -comparison is performed. +comparison is performed.
+ +If one of the operands is an enum and the other operand is a +string, the string is converted to the value of a matching enum +constant before the above conversion.

  • Comparisons for equality/inequality never raise an error. Even incompatible pointers can be compared for equality by address. Any -- cgit v1.2.3-55-g6feb