nothings / stb

stb single-file public domain libraries for C/C++
https://twitter.com/nothings
Other
26.31k stars 7.69k forks source link

This prevents few warnings that appear when compiling with clang #1472

Closed oviano closed 1 year ago

oviano commented 1 year ago

Examples of these warnings:

stb_image_write.h:776:13: error: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security
      concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Werror,-Wdeprecated-declarations]
      len = sprintf(buffer, "EXPOSURE=          1.0000000000000\n\n-Y %d +X %d\n", y, x);
./thirdparty/stb/stb_image_write.h:518:32: error: missing field 'context' initializer [-Werror,-Wmissing-field-initializers]
   stbi__write_context s = { 0 };
                               ^
nothings commented 1 year ago

We generally do not like to put pragma warning directives into the libraries. See https://github.com/nothings/stb/issues/1458#issuecomment-1465084305 for some explanations.