“Jean-Pierre H. Dumas” <jeanpierre.dumas at freesbee.fr> wrote:
Here are the diff’s to get a more correct
test/testsprite.c.
(Make them bouncing at a correct place, considering the screen surface.)
Please send patches in unified diff formats so we can read them.
Also if you are going to fix testsprite, please do it properly. You want
to test clipped RLE blits in all directions. The whole program needs an
overhaul anyway.
Heh, everyone seems to use atexit in SDL programs, example or not. What
problems have been found with it?On Wed, Feb 06, 2002 at 10:24:22AM -0800, Sam Lantinga wrote:
SDL_Quit();
This isn’t needed, taken care of by atexit()
atexit is problematic for other reasons though, and probably shouldn’t
be used in SDL example programs.
–
Joseph Carter Do not write in this space
“my biggest problem with RH (and especially RH contrib packages) is that
they DON’T have anything like our policy. That’s one of the main reasons
why their packages are so crappy and broken. Debian has the teamwork
side of building a distribution down to a fine art.”
For example, if somebody registers an atexit function before the
atexit(SDL_Quit), and calls an SDL function from it, then the application
may crash in a way that is very hard to debug. Static C++ objects that
call SDL functions from ctors/dtors have this problem too (never use them!)
In general, if you rely on explicit ordering of application cleanup, you
should check and perform all steps yourself in your own cleanup function.
See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment> On Wed, Feb 06, 2002 at 10:24:22AM -0800, Sam Lantinga wrote:
SDL_Quit();
This isn’t needed, taken care of by atexit()
atexit is problematic for other reasons though, and probably shouldn’t
be used in SDL example programs.
Heh, everyone seems to use atexit in SDL programs, example or not. What
problems have been found with it?
For example, if somebody registers an atexit function before the
atexit(SDL_Quit), and calls an SDL function from it, then the application
may crash in a way that is very hard to debug.
But since the order of atexit-registered functions calls is well-defined
this is not a fundamental problem. Registering an atexit function that
cannot be called immediately is always a bug.
In general, if you rely on explicit ordering of application cleanup, you
should check and perform all steps yourself in your own cleanup function.
Generally I use one anyway because I may want to print out debugging info
for the crashes caught by the program (“impossible” cases, memory debug
stuff, etc) and because we’d like to be able to gracefully die from the
majority of crashes.
What I wish we could do is have SDL tell us when we have an ungraceful
crash in progress so that we can implement our own parachutes. The one
SDL has is sometimes not sufficient, and signal catching tends to have
different semantics on different OSes. I have not looked to see if
there’s anything OS-specific in the parachute code, but if it just calls
SDL_Quit, a new SDL_Init flag SDL_USER_PARACHUTE or something is on my
wishlist. Probably should be accompanied by a warning not to get too
fancy with it, since it’s being called when, eg, you just segfaulted.On Thu, Feb 07, 2002 at 09:51:03AM -0800, Sam Lantinga wrote:
SDL_Quit();
This isn’t needed, taken care of by atexit()
atexit is problematic for other reasons though, and probably shouldn’t
be used in SDL example programs.
Heh, everyone seems to use atexit in SDL programs, example or not. What
problems have been found with it?
It doesn’t work well with other cleanup code.
For example, if somebody registers an atexit function before the
atexit(SDL_Quit), and calls an SDL function from it, then the application
may crash in a way that is very hard to debug. Static C++ objects that
call SDL functions from ctors/dtors have this problem too (never use them!)
In general, if you rely on explicit ordering of application cleanup, you
should check and perform all steps yourself in your own cleanup function.
–
Joseph Carter I swallowed your goldfish
Indifference will certainly be the downfall of mankind, but who cares?