From a6d2477e3f7e9c0c104a97a43eb54035c84d7e50 Mon Sep 17 00:00:00 2001 From: Jeremy Rifkin <51220084+jeremy-rifkin@users.noreply.github.com> Date: Tue, 20 Aug 2024 22:55:05 -0500 Subject: [PATCH] Update readme --- README.md | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 0c44c8a..aceb701 100644 --- a/README.md +++ b/README.md @@ -375,17 +375,24 @@ Cpptrace provides `CPPTRACE_TRY` and `CPPTRACE_CATCH` macros that allow a stack thrown exception object, with minimal or no overhead in the non-throwing path: ```cpp -CPPTRACE_TRY { - foo(); -} CPPTRACE_CATCH(const std::exception& e) { - std::cerr<<"Exception: "< +void foo() { + throw std::runtime_error("foo failed"); +} +int main() { + CPPTRACE_TRY { + foo(); + } CPPTRACE_CATCH(const std::exception& e) { + std::cerr<<"Exception: "<`. -Any declarator `catch` accepts works with `CPPTRACE_CATCH`, including `...`. +Any declarator `catch` accepts works with `CPPTRACE_CATCH`, including `...`. This works with any thrown object, not just +`std::exceptions`, it even works with `throw 0;` ![from_current](res/from_current.png)