mirror of
https://github.com/ZDoom/Raze.git
synced 2025-05-30 17:01:03 +00:00
-perform a proper exit, i.e. make sure that the deinit code can run, by throwing a special exception and actually catching it in the main function.
This commit is contained in:
parent
0d878a8604
commit
1c29169492
5 changed files with 29 additions and 20 deletions
|
@ -652,11 +652,18 @@ static FORCE_INLINE int32_t Blrintf(const float x)
|
|||
# define ERRprintf(fmt, ...) fprintf(stderr, fmt, ## __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#ifdef DEBUGGINGAIDS
|
||||
# define Bexit(status) do { initprintf("exit(%d) at %s:%d in %s()\n", status, __FILE__, __LINE__, EDUKE32_FUNCTION); exit(status); } while (0)
|
||||
#else
|
||||
# define Bexit(a) exit(a)// throw(1)
|
||||
#endif
|
||||
class ExitEvent : public std::exception
|
||||
{
|
||||
int reason;
|
||||
public:
|
||||
ExitEvent(int a) { reason = a; }
|
||||
int Reason() const { return reason; }
|
||||
};
|
||||
|
||||
inline void Bexit(int a)
|
||||
{
|
||||
throw ExitEvent(a);
|
||||
}
|
||||
|
||||
|
||||
////////// Standard library monkey patching //////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue