On Fri, Jan 23, 2015 at 01:05:48AM +0200, Niccolo Medici wrote:
<snip>
Lua 5.3 deprecates luaL_checkint, luaL_checklong, luaL_optint,
luaL_optlong, which were just convenience macros calling
luaL_{check|opt}integer.
While we can still use them (because of -DLUA_COMPAT_5_2), they aren't
mentioned in the user manual and we're advised to use
luaL_{check|opt}integer "with a type cast".
[...]
(2) If a cast isn't needed here, where *is* it needed?
Assuming an architecture where sizeof (int) < sizeof (lua_Integer), then the
following would print two different results:
printf("%zu\n", sizeof luaL_checkinteger(0, 0));
printf("%zu\n", sizeof ((int)luaL_checkinteger(0, 0)));