Is it "Safe" to use IMG_SavePNG()?

Hi. This is my first post, so I hope this is in the right place. :slight_smile:

I would like to make use of the IMG_SavePNG() api provided by SDL_Image. It appears to work as expected, but I note that it is undocumented in the SDL_Image documentation. Is this a sign that I should not rely on it? Is it likely to go away in the future, or does it have some other platform specific problems I should be aware of?

Thanks!

It is an unfortunate fact that many developers are very bad at
maintaining documentation, if they do it at all and don’t rely on 3rd
party contributors. SDL is a particularly sad example of this.

As a general rule for all C libraries, the public header files (in this
case SDL_image.h) are the law. Developers actively maintain these and
if there is any commitment to backwards compatibility by a library,
developers will try to keep these headers compatible.

Missing or incorrect documentation is never a sign of anything other
than the developers’ sloppiness with respect to maintaining
documentation.

MSB

Thank you for that advice. Treating header files as a form of documentation is a nice way to look at it. That makes me relatively reassured about using the api. Cheers.

But you should report the missing documentation to the SDL_image
developer.

MSB

I wouldn’t say that is generally true. For example in the case of Windows the formal documentation represents the contract between Microsoft and the application programmer as to which APIs are officially supported and how they are supposed to work. The public header files are intended to be read by a compiler, not a human, and will neither contain the same level of detail nor have the same legal significance.