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()
?
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.