Tomash Brechko
2014-09-18 14:18:44 UTC
Hello!
According to documentation LuaJIT parser complies to C99 standard, however
the following code fails:
ffi = require("ffi")
ffi.cdef[[ void f(int size, char a[size]); ]]
or
ffi = require("ffi")
ffi.cdef[[ void g(char b[static 5]); ]]
Both are optimizer hints meaning that 'a' has exactly 'size' elements, and
'b' is at least 5 elements long (IIRC). Since those are hints LuaJIT may
parse and ignore them, so the fix shouldn't be complex.
Tested with 2.0 and 2.1. Sorry if this has been discussed before.
According to documentation LuaJIT parser complies to C99 standard, however
the following code fails:
ffi = require("ffi")
ffi.cdef[[ void f(int size, char a[size]); ]]
or
ffi = require("ffi")
ffi.cdef[[ void g(char b[static 5]); ]]
Both are optimizer hints meaning that 'a' has exactly 'size' elements, and
'b' is at least 5 elements long (IIRC). Since those are hints LuaJIT may
parse and ignore them, so the fix shouldn't be complex.
Tested with 2.0 and 2.1. Sorry if this has been discussed before.
--
Tomash Brechko
Tomash Brechko