RE: [GD-General] longjmp for C++
Brought to you by:
vexxed72
From: Corrinne Y. <cor...@sp...> - 2002-01-09 18:32:02
|
-----Original Message----- From: gam...@li... [mailto:gam...@li...] On Behalf Of Daniel Vogel Sent: Wednesday, January 09, 2002 11:50 AM To: cor...@sp...; Gam...@li... Subject: RE: [GD-General] longjmp for C++ On Windows you can use exceptions for almost all case where you'd want to use longjmp/ setjmp. On Linux you can't use exceptions that well but longjmp/ setjmp are extremely slow there :( 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. |