Re: MSVC warnings when compiling Lua as C++

Roberto Ierusalimschy <[email protected]> Wed, 29 Jul 2026 13:14:17 -0300
Newsgroups gmane.comp.lang.lua.general
Message-ID <[email protected]>
> Hmm, I guess MSVC wants you to be explicit about what result type you expect in this case.
> 
> -#define sizenode(t)	(twoto((t)->lsizenode))
> +#define sizenode(t)	(cast_int(twoto((t)->lsizenode)))
> 
> This also suppresses it.

It is funny, casting an int expression to int :-)  But if it suppresses
the warning, we can live with that.

As we are here, can you check whether this cast to int supersedes the
previous cast to size_t? In particular:

In lgc.c:
-#define gnodelast(h)    gnode(h, cast_sizet(sizenode(h)))
+#define gnodelast(h)    gnode(h, sizenode(h))

Many thanks,

-- Roberto

-- 
You received this message because you are subscribed to the Google Groups "lua-l" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/lua-l/20260729161417.GA135244%40arraial.inf.puc-rio.br.