RE: [GD-General] longjmp for C++
Brought to you by:
vexxed72
From: Corrinne Y. <cor...@sp...> - 2002-01-09 20:54:54
|
-----Original Message----- From: gam...@li... [mailto:gam...@li...] On Behalf Of Thatcher Ulrich Sent: Wednesday, January 09, 2002 12:47 PM To: Gam...@li... Subject: Re: [GD-General] longjmp for C++ On Jan 09, 2002 at 12:31 -0600, Corrinne Yu wrote: > Out of curiosity, what are you using longjmp/setjmp for? > > -- Daniel, Epic Games Inc. > > -- It can be a convenient/lazy :) way to restart a clean game. > > -- You set jump after all the startup but before game specific code. > Then when a game ends, you can just long jump back to the state after > startup but before game code. You can use the same idea to rewind a game > (after game data loaded, but before any game play changes has started). > > -- Another way (which is the way it is done now) is to do a full cleanup > after game ends and manually restores state to start up but before game > data load. > > -- The lazy jump way of restarting is only safe for a pure C app. Our > code base has now a lot of C++ classes and need to have their objects be > destroyed and constructed properly. Long jump is not guaranteed to do > that correctly. Neither setjmp/longjmp nor exceptions are going to do anything for your heap, though, correct? Which seems like the much tougher issue. -- Not if all your heaps are part of the environment context, even your C++ ones. P.S. It's funny the mail editor insists longjmp should be spelled longhop. :) |