// Conditional Match (or Re-Raise) #include #include #include #include EHM_EXCEPTION(empty_exception)(); EHM_VIRTUAL_TABLE(empty_exception, empty_vt); bool should_catch = false; void throw_exception() { throwResume (empty_exception){&empty_vt}; } void cond_catch() { try { throw_exception(); } catchResume (empty_exception * exc ; should_catch) { asm volatile ("# fixup block (conditional)"); } } int main(int argc, char * argv[]) { unsigned int times = 1; if (1 < argc) { times = strtol(argv[1], 0p, 10); } if (2 < argc) { should_catch = strtol(argv[2], 0p, 10); } Time start_time = timeHiRes(); for (unsigned int count = 0 ; count < times ; ++count) { try { cond_catch(); } catchResume (empty_exception * exc) { asm volatile ("# fixup block (unconditional)"); } } Time end_time = timeHiRes(); sout | "Run-Time (ns): " | (end_time - start_time)`ns; }