FWGS / xash3d

DEPRECATED in favor of https://github.com/FWGS/xash3d-fwgs. Only bugfixes are accepted.
https://xash.su
GNU General Public License v3.0
551 stars 109 forks source link

Update stb libraries #355

Closed fuzun closed 6 years ago

fuzun commented 6 years ago

Stb libraries are outdated and they make debugging not so easy.

a1batross commented 6 years ago

What do you mean "std" libraries?

fuzun commented 6 years ago

Sorry it was a typo. I meant "STB" library, I am correcting it now. Which is actually only 1 file: stb_sprintf.h it seems.

In file it says that version is v1.02. But in the stated github address ( http://github.com/nothings/stb ) the current version is: v1.05.

I do not know if this fixes debugging issues (It needs to be updated anyway) but it sometimes become really annoying that I switch the crt version while debugging.

mittorn commented 6 years ago

It will not solve debugging issues because it using some dangerous optimizations (like XASH_FASTSTR). And it does not work correctly on platforms that does not allow unaligned access too. Maybe just add debug detection in make/cmake files and do not use it on debug crt? I will check stb_sprintf and update it if needed.

fuzun commented 6 years ago

@mittorn Okay so it will not be debug friendly.

I think instead of changing make files using macros may be better. Something like this in port.h (Assuming they are type compatible)

ifndef NDEBUG // It seems that NDEBUG (msvc) is not standard so first check is MSVC used ?

define Q_snprintf snprintf

endif

a1batross commented 6 years ago

@mittorn debug and release configurations shouldn't differ as possible.

What's exactly don't work in debugging? I don't using VS debugger regularly, but when I do, everything works fine.

fuzun commented 6 years ago

Format errors. (%f for printing int etc.)

a1batross commented 6 years ago

I need to boot into Windows to look what is wrong with debugging, but for now I have removed hardcode in f5cedcc6a9fafef83386e288c8de57518bb83863.

Now you can disable it by disabling XASH_USE_STB_SPRINTF in CMake. Or just not pass this define to compiler, if you don't want to use it.