by eska · 2y ago · 0 comments
I'm pretty sure windows uses "long" for 64 bit but linux uses "long long" for 64 bit
You can still typedef those to i32, i64 shortcuts etc, but I would try to avoid this in libraries since it might collide with user typedefs of the same name - or at least try to avoid it in the public API declarations.
Source: https://handmade.network/forums/articles/t/7138-how_to_write...
AFAIK the STB headers are on C89 mainly because nothings likes to use VC6 as C IDE.
E.g. if you depend on other C99 features anyway, including stdint.h is fine, also on MSVC.
PS: FWIW I use stdint.h types in the Sokol headers since around 2017 and never heard complaints from users, with the supported compilers being MSVC, GCC and Clang.
Windows long is 32bit even on 64bit CPUs.
Linux long is arch dependent and is 64bit on x64, 32bit on x86.
long long is always 64bit on both platforms.
I just roll my own for this because I don't need all the functionality, and generally find such cross-platform libraries to only really test on Linux, and it's too much of a hassle.
other way around