// Throw Across Other Handler #include #include EHM_EXCEPTION(empty_exception)(); EHM_VIRTUAL_TABLE(empty_exception, empty_vt); EHM_EXCEPTION(not_raised_exception)(); void unwind_other(unsigned int frames) { if (frames) { try { unwind_other(frames - 1); } catch (not_raised_exception *) { // ... } } else { throw (empty_exception){&empty_vt}; } } int main(int argc, char * argv[]) { unsigned int times = 1; unsigned int total_frames = 1; if (2 < argc) { times = strtol(argv[1], 0p, 10); } if (3 < argc) { total_frames = strtol(argv[2], 0p, 10); } for (int count = 0 ; count < times ; ++count) { try { unwind_other(total_frames); } catch (empty_exception *) { // ... } } }