News for hackers. Stuff that matters.
Re:RGFW: Single-header C99 window abstraction library by eska on Saturday November 23, 2024 @10:43AM (#42221468)
Not sure whether this is tested on Windows at all. I opened the header and immediately found this `typedef signed long i64`, i.e. i64 is actually i32.
Re:RGFW: Single-header C99 window abstraction library by colleagueRiley on Saturday November 23, 2024 @11:20AM (#42221639)
I test Windows mainly with MINGW, that might be an issue with MSVC. Feel free to report the issue on the github repository.

I'm pretty sure windows uses "long" for 64 bit but linux uses "long long" for 64 bit

Re:RGFW: Single-header C99 window abstraction library by flohofwoe on Saturday November 23, 2024 @11:51AM (#42221818)
Since you're using C99 as the base C version, why not use the fixed-width types from stdint.h (int32_t, int64_t, ...)?

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.

Re:RGFW: Single-header C99 window abstraction library by colleagueRiley on Saturday November 23, 2024 @11:58AM (#42221876)
I use those by default although I read that MSVC's support for those are iffy. I'm pretty sure STB does the same thing for the same reason.

Source: https://handmade.network/forums/articles/t/7138-how_to_write...

Re:RGFW: Single-header C99 window abstraction library by flohofwoe on Saturday November 23, 2024 @12:00PM (#42221893)
Since around Visual Studio 2015 you're fine.

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.

Re:RGFW: Single-header C99 window abstraction library by colleagueRiley on Saturday November 23, 2024 @12:08PM (#42221952)
Oh, I wasn't sure if that was you :)

Thanks for the advice, I'm a little worried about breaking compatibility with compilers that don't support stdint. But if it's standard for C99 thing then sure.

Re:RGFW: Single-header C99 window abstraction library by eska on Saturday November 23, 2024 @12:33PM (#42222139)
Since around Visual Studio 2015 you're fine.

I personally use `_MSC_VER >= 1600`, so it's since Visual Studio 2010 from April 2010. Built-in types like __int32 from before then may be used as well.

Re:RGFW: Single-header C99 window abstraction library by eska on Saturday November 23, 2024 @11:31AM (#42221701)
It's just that the #if checks for the MSVC compiler, not for Windows as a platform. And on that compiler you will never have LP64, but LLP64: https://en.wikipedia.org/wiki/64-bit_computing#64-bit_data_m...

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.

Re:RGFW: Single-header C99 window abstraction library by colleagueRiley on Saturday November 23, 2024 @11:48AM (#42221794)
Yes, because MSVC may or may not have stdint.h
Re:RGFW: Single-header C99 window abstraction library by immibis on Saturday November 23, 2024 @10:30PM (#42225732)
It does. Why do you think it might not?
Re:RGFW: Single-header C99 window abstraction library by tredre3 on Saturday November 23, 2024 @11:27AM (#42221675)
> I'm pretty sure windows uses "long" for 64 bit but linux uses "long long" for 64 bit

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.

Re:RGFW: Single-header C99 window abstraction library by colleagueRiley on Saturday November 23, 2024 @11:37AM (#42221737)
Okay, thank you.
Re:RGFW: Single-header C99 window abstraction library by Iwan-Zotow on Sunday November 24, 2024 @10:12AM (#42228283)
> I'm pretty sure windows uses "long" for 64 bit but linux uses "long long" for 64 bit

other way around

Re:RGFW: Single-header C99 window abstraction library by Conscat on Saturday November 23, 2024 @11:17AM (#42221617)
I'm not sure that issue would be caught by ordinary testing. It will implicitly cast into long long, so it might make little or no difference in this case.
Re:RGFW: Single-header C99 window abstraction library by eska on Saturday November 23, 2024 @11:34AM (#42221722)
A lot of people use i64 in the global namespace, so this will affect later code. It's basically `#define true false`. When I consider a library I will do a quick sniff test to look for very obvious mistakes, at which point I won't look further.
Re:RGFW: Single-header C99 window abstraction library by colleagueRiley on Saturday November 23, 2024 @11:55AM (#42221855)
:( That's disappointing, but I understand.
Re:RGFW: Single-header C99 window abstraction library by InfiniteRand on Saturday November 23, 2024 @01:21PM (#42222556)
It depends whether you're compiling in 32-bit or 64-bit mode, MSVC has two different modes and there are different versions of MinGW for 32-bit and 64-bit
Re:RGFW: Single-header C99 window abstraction library by tom_ on Saturday November 23, 2024 @02:06PM (#42223005)
Re:RGFW: Single-header C99 window abstraction library by bluecalm on Saturday November 23, 2024 @01:35PM (#42222715)
This is strange because C99 has stdint.h so we don't need to use "short/long/long long/long long long" nonsense anymore.