[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: In `lua.h`, `LUA_VERSION_RELEASE_NUM` does not reflect `LUA_VERSION_RELEASE`
- From: Thorkil Naur <naur@...>
- Date: Tue, 12 Jan 2021 13:39:32 +0100
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