Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Is SDL_FreeSurface() equivalent to free() in terms of functionality?

I’m trying to free a bunch of things with different types, and so I think I might be able to free all of
them using one function by adding them to a pile of void * cells.

My question is: is it safe to save an SDL_Surface* as void * and use the free() function without the need of SDL_FreeSurface()?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

No, you have to use SDL_FreeSurface. (Evidence: what it does)

Except in specific cases, it’s never safe to just use one free function instead of another. You free things you allocate with malloc. You CloseHandle things opened with CreateFile (on Windows). You fclose files you opened with fopen. And so on.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading