⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 except.c

📁 关于图的深度搜索的C语言代码实现
💻 C
字号:
#include <stdlib.h>
#include <stdio.h>
#include "assert.h"
#include "except.h"


#define T Except_T

#ifdef WIN32
        __declspec(thread)
#endif

Except_Frame *Except_stack = NULL;

void Except_raise(const T *e, const char *file, int line)
{
        Except_Frame *p = Except_stack;
        assert(e);
        if (p == NULL)
        {
                fprintf(stderr, "Uncaught exception");
                if (e->reason)
                        fprintf(stderr, " %s", e->reason);
                else
                        fprintf(stderr, " at 0x%p", e);
                if (file && line > 0)
                        fprintf(stderr, " raised at %s:%d\n", file, line);
                fprintf(stderr, "aborting...\n");
                fflush(stderr);
                abort();
        }
        p->exception = e;
        p->file = file;
        p->line = line;
        Except_stack = Except_stack->prev;
        longjmp(p->env, Except_raised );
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -