// Throw Across Finally #include #include EHM_EXCEPTION(empty_exception)(); EHM_VIRTUAL_TABLE(empty_exception, empty_vt); void unwind_finally(unsigned int frames) { if (frames) { try { unwind_finally(frames - 1); } finally { // ... } } else { throwResume (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_finally(total_frames); } catchResume (empty_exception *) { // ... } } }