From cb9af93e0b568984dcc103e378f2726c0e56863e Mon Sep 17 00:00:00 2001 From: Andrew Kesterson Date: Sat, 10 Jan 2026 22:03:14 -0500 Subject: [PATCH] README fixes, fix a bug in the header stdlib checking --- README.md | 5 +++-- include/akerror.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 50198be..1d11460 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ This library has 6 guiding principles: TL;DR - `akerr_ErrorContext` objects are filled with error context information and bubbled up through nested control structures until they are handled or reach the top level, where an unhandled error halts program termination with a stack trace -1. At the point where an error occurs, an `akerr_ErrorContext` object is created and populated with information regarding the failure +1. At the point where an error occurs, an `akerr_ErrorContext` object is initialized and populated with information regarding the failure 2. The akerr_ErrorContext is returned from the scope where the error was detected 3. The akerr_ErrorContext enters a control structure provided by the AKError library through a series of macros that examine `akerr_ErrorContext` objects as they pass through 4. The control structure checks to see if the `akerr_ErrorContext` has an error set, and if so, if there are any handlers in the current control structure that can handle it @@ -172,7 +172,8 @@ ATTEMPT { `PROCESS(errctx) { ... }` is the block within which you will handle any errors that were caught inside of the `ATTEMPT` block. See "Handling Errors" below. -`FINISH(errctx, true)` terminates the attempt operation. The `FINISH` macro takes two arguments: the name of the akerr_ErrorContext, and a boolean regarding whether or not to pass unhandled errors up to the calling function. Unless you have a good reason not to, this should be true. +`FINISH(errctx, true)` terminates the attempt operation. The `FINISH` macro takes two arguments: the name of the akerr_ErrorContext, and a boolean regarding whether or not to pass unhandled errors up to the calling function. Unless you are inside of your `main()` method, this should be true. Inside of your `main()` method, call `FINISH_NORETURN(errctx)` instead. + # Capturing errors diff --git a/include/akerror.h b/include/akerror.h index 6667989..9d4187a 100644 --- a/include/akerror.h +++ b/include/akerror.h @@ -1,7 +1,7 @@ #ifndef _AKERR_H_ #define _AKERR_H_ -#if defined(AKERR_USE_STDLIB) && AKERR_USE_STDLIB == 1 +#if (defined(AKERR_USE_STDLIB) && AKERR_USE_STDLIB == 1) || (!defined(AKERR_USE_STDLIB)) #include #include #include