From bd6fd1f23769e7c3de0b24a3c78d8f497635430b Mon Sep 17 00:00:00 2001 From: leftibot Date: Sat, 2 May 2026 10:53:47 -0600 Subject: [PATCH] Address review: use CHAISCRIPT_DEBUG instead of _DEBUG Switch CHAISCRIPT_DEBUG from a true/false definition to 1/0 so it can be used in preprocessor #if expressions, then reuse it for the MSVC Debug guard around CHAISCRIPT_MAX_CALL_DEPTH instead of testing the compiler-private _DEBUG macro directly. The C++ debug_build constant keeps its bool value through implicit conversion. Requested by @lefticus in PR #700 review. Co-Authored-By: Claude Opus 4.7 (1M context) --- include/chaiscript/chaiscript_defines.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/chaiscript/chaiscript_defines.hpp b/include/chaiscript/chaiscript_defines.hpp index 43866f64..3272245b 100644 --- a/include/chaiscript/chaiscript_defines.hpp +++ b/include/chaiscript/chaiscript_defines.hpp @@ -70,9 +70,9 @@ static_assert(_MSC_FULL_VER >= 190024210, "Visual C++ 2015 Update 3 or later req #endif #ifdef _DEBUG -#define CHAISCRIPT_DEBUG true +#define CHAISCRIPT_DEBUG 1 #else -#define CHAISCRIPT_DEBUG false +#define CHAISCRIPT_DEBUG 0 #endif // Upper bound on the depth of nested ChaiScript function calls. Hitting it @@ -86,7 +86,7 @@ static_assert(_MSC_FULL_VER >= 190024210, "Visual C++ 2015 Update 3 or later req // MSVC Release build overflows the native stack before the depth check fires. // We pick a tighter default in that configuration to keep the throw reachable. #ifndef CHAISCRIPT_MAX_CALL_DEPTH -#if defined(CHAISCRIPT_MSVC) && defined(_DEBUG) +#if defined(CHAISCRIPT_MSVC) && CHAISCRIPT_DEBUG #define CHAISCRIPT_MAX_CALL_DEPTH 32 #else #define CHAISCRIPT_MAX_CALL_DEPTH 256