Making STL Vectors and SDL_Surfaces place nicely
Moderator: Coders of Rage
- dandymcgee
- ES Beta Backer
- Posts: 4709
- Joined: Tue Apr 29, 2008 3:24 pm
- Current Project: https://github.com/dbechrd/RicoTech
- Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
- Programming Language of Choice: C
- Location: San Francisco
- Contact:
Re: Making STL Vectors and SDL_Surfaces place nicely
Word of advice: After you free a surface (or delete anything for that matter) you should set the pointer to NULL. In this case you don't even need to check for NULL before calling SDL_FreeSurface, because it handles them nicely, i.e., checks and does nothing.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
- treyrust
- Chaos Rift Newbie
- Posts: 36
- Joined: Thu Jul 21, 2011 4:32 pm
- Current Project: Between projects
- Favorite Gaming Platforms: PS1/2/3/P, NES, Wii, Genesis, Dreamcast, GBA, DS
- Programming Language of Choice: C++
Re: Making STL Vectors and SDL_Surfaces place nicely
Neat, but you should be careful what NULL pointers you pass to any part of SDL, I'm not saying SDL_FreeSurface doesn't handle it well but other parts are not so nice. But good advice either way, you should never have a pointer that isn't either pointing to something useful or NULL.dandymcgee wrote:Word of advice: After you free a surface (or delete anything for that matter) you should set the pointer to NULL. In this case you don't even need to check for NULL before calling SDL_FreeSurface, because it handles them nicely, i.e., checks and does nothing.