When compiling with gcc.exe (Rev6, Built by MSYS2 project) 13.1.0 using -Wextra, the following error is produced:
./stb/stb_sprintf.h: In function 'stbsp_vsprintfcb':
./stb/stb_sprintf.h:594:51: warning: operand of '?:' changes signedness from 'int' to 'unsigned int' due to unsignedness of other operand [-Wsign-compare]
594 | l = stbsp__strlen_limited(s, (pr >= 0) ? pr : ~0u);
| ^~
To Reproduce
Write a simple "Hello, World" program using stb_sprintf and compile with gcc using -Wall and -Wextra options.
Clang does not produce the warning for the same code and compiler options.
Describe the bug
When compiling with
gcc.exe (Rev6, Built by MSYS2 project) 13.1.0
using-Wextra
, the following error is produced:To Reproduce
Write a simple "Hello, World" program using stb_sprintf and compile with
gcc
using-Wall
and-Wextra
options.Clang does not produce the warning for the same code and compiler options.
The simple fix is to change line 594 (cast
pr
):