Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

how to fail???

Name: poor noobling 2008-10-23 12:22

Alright so I've got a lot of shit that should be done at the end of this program (closing any open files, ending SDL and/or Winsocks, freeing mallocated memory, etc).

But I can't always be sure when/where this program will terminate.

How do I make my codez so that I know it will always perform the clean-up code etc whenever I want the program to end?

Name: Anonymous 2008-10-24 16:51

>>4
Keep a stack of cleanup functions for every simple task, and depending on the location in your program, push or pop the stack of functions. In the atexit function, just pop each value from the stack and call the function pointer.

I created this technique.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List