Re: MSVC warnings when compiling Lua as C++

ppp vvv <[email protected]> Thu, 30 Jul 2026 02:36:45 -0700 (PDT)
Newsgroups gmane.comp.lang.lua.general
Message-ID <[email protected]>
------=_Part_28492_671784592.1785404205707
Content-Type: multipart/alternative; 
	boundary="----=_Part_28493_578670139.1785404205707"

------=_Part_28493_578670139.1785404205707
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

> Maybe there would be some value in using int32_t, uint32_t, int64_t, etc.=
=20
when C99 is available.

it is a good idea to use proper stdint types even without C99,

and then "backport" it to C89 if needed in luaconf.h

#if defined(LUA_USE_C89)
typedef char int8_t;
typedef unsigned char uint8_t;
typedef short  int16_t;
typedef unsigned short uint16_t;
typedef int int32_t;
typedef unsigned int uint32_t;
typedef long long  int64_t;
typedef unsigned long long uint64_t;

probably with a few more #ifdefs for signed/unsigned chars and 32 bit ints=
=20
on x64, etc

=D1=87=D0=B5=D1=82=D0=B2=D0=B5=D1=80=D0=B3, 30 =D0=B8=D1=8E=D0=BB=D1=8F 202=
6=E2=80=AF=D0=B3. =D0=B2 08:20:10 UTC+2, Sainan:=20

> Ah, I actually didn't know that 'int' was ever not 32-bit. The only quirk=
=20
> I ever ran into was 'char' meaning 'unsigned char' on some ARM compilers.
>
> Maybe there would be some value in using int32_t, uint32_t, int64_t, etc.=
=20
> when C99 is available.
>
> -- Sainan
>

--=20
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 e=
mail to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/lua-l/cb582=
9e4-5bdb-45c0-a987-500530d8d3d6n%40googlegroups.com.

------=_Part_28493_578670139.1785404205707
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div>&gt; Maybe there would be some value in using int32_t, uint32_t, int64=
_t, etc. when C99 is available.</div><div><br /></div>it is a good idea to =
use proper stdint types even without C99,<div><br /></div><div>and then "ba=
ckport" it to C89 if needed in luaconf.h</div><div><br /></div><div>#if def=
ined(LUA_USE_C89)</div><div><div>typedef char int8_t;<br />typedef unsigned=
 char uint8_t;<br /></div></div><div>typedef short=C2=A0 int16_t;<br />type=
def unsigned short uint16_t;<br /></div><div>typedef int int32_t;</div>type=
def unsigned int uint32_t;<br /><div>typedef long long =C2=A0int64_t;<br />=
typedef unsigned long long uint64_t;</div><div><br /></div><div>probably wi=
th a few more #ifdefs for signed/unsigned chars and 32 bit ints on x64, etc=
</div><div><br /></div><div class=3D"gmail_quote"><div dir=3D"auto" class=
=3D"gmail_attr">=D1=87=D0=B5=D1=82=D0=B2=D0=B5=D1=80=D0=B3, 30 =D0=B8=D1=8E=
=D0=BB=D1=8F 2026=E2=80=AF=D0=B3. =D0=B2 08:20:10 UTC+2, Sainan: <br/></div=
><blockquote class=3D"gmail_quote" style=3D"margin: 0 0 0 0.8ex; border-lef=
t: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Ah, I actually didn&#3=
9;t know that &#39;int&#39; was ever not 32-bit. The only quirk I ever ran =
into was &#39;char&#39; meaning &#39;unsigned char&#39; on some ARM compile=
rs.
<br>
<br>Maybe there would be some value in using int32_t, uint32_t, int64_t, et=
c. when C99 is available.
<br>
<br>--=C2=A0Sainan
<br></blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;lua-l&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:[email protected]">lua-l+unsubsc=
[email protected]</a>.<br />
To view this discussion visit <a href=3D"https://groups.google.com/d/msgid/=
lua-l/cb5829e4-5bdb-45c0-a987-500530d8d3d6n%40googlegroups.com?utm_medium=
=3Demail&utm_source=3Dfooter">https://groups.google.com/d/msgid/lua-l/cb582=
9e4-5bdb-45c0-a987-500530d8d3d6n%40googlegroups.com</a>.<br />

------=_Part_28493_578670139.1785404205707--

------=_Part_28492_671784592.1785404205707--