lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello,

On Tue, Jan 12, 2021 at 09:06:41PM +0900, Lemures Lemniscati wrote:
> ...
> -#define LUA_VERSION_NUM			504
> -#define LUA_VERSION_RELEASE_NUM		(LUA_VERSION_NUM * 100 + 0)
> +#define LUA_VERSION_NUM		(LUA_VERSION_MAJOR * 100 + LUA_VERSION_MINOR)
> +#define LUA_VERSION_RELEASE_NUM	(LUA_VERSION_NUM * 100 + LUA_VERSION_RELEASE)

For lua-5.4.2, this causes:

> lua.h:27:59: error: invalid operands to binary * (have ‘char *’ and ‘int’)
>    27 | #define LUA_VERSION_NUM                (LUA_VERSION_MAJOR * 100 + LUA_VERSION_MINOR)
>       |                                                           ^
> lapi.c:148:10: note: in expansion of macro ‘LUA_VERSION_NUM’
>   148 |   return LUA_VERSION_NUM;
>       |          ^~~~~~~~~~~~~~~
> lapi.c:149:1: warning: control reaches end of non-void function [-Wreturn-type]
>   149 | }
>       | ^

>  ...

LUA_VERSION_MAJOR is a string:

>  #define LUA_VERSION_MAJOR	"5"

So using it as a number in C is an error.

Best
Thorkil