Re: MSVC warnings when compiling Lua as C++

Roberto Ierusalimschy <[email protected]> Thu, 30 Jul 2026 13:32:25 -0300
Newsgroups gmane.comp.lang.lua.general
Message-ID <[email protected]>
> I'm not sure I entirely understand what you're asking, but that patch for lgc.c does not seem to change the warnings MSVC emits.

The first time this warning appeared (around 2011, I guess), we added
a cast whenever sizenode was used as an array index, as here:

-#define gnodelast(h)    gnode(h, sizenode(h))
+#define gnodelast(h)    gnode(h, cast_sizet(sizenode(h)))

The rationale was that, as it complained of an implicit conversion, we
made the conversion explicit. As far as I can tell, that change stopped
the warnings at that time.

If adding a cast to int stops the warning, maybe we won't need this
other cast anymore.

-- 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/20260730163225.GC11249%40arraial.inf.puc-rio.br.