ToyGine2 26.2.0
Game Engine for retro consoles
Loading...
Searching...
No Matches
assertion.hpp File Reference

Assertion system: callbacks, initialize/shutdown, and assertion() entry point. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  toy::assertion
 Configurable assertion failure handling and optional stack trace.
namespace  toy
 Root namespace containing all engine modules.

Typedefs

using toy::assertion::AssertionCallback = bool (*)(const char * assertionString)
 Called on assertion failure; receives a single formatted string (expression, message, file, function, line).
using toy::assertion::StackWalkCallback = void (*)(const char * stackFrameString)
 Called for each stack frame when generating a trace; receives one formatted frame string.

Functions

void toy::assertion::initialize ()
 Prepares the assertion system; call before using assertion macros or setCallbacks().
void toy::assertion::deInitialize ()
 Shuts down the assertion system and clears callbacks.
void toy::assertion::setCallbacks (AssertionCallback assertionCallback, StackWalkCallback stackWalkCallback)
 Registers the assertion and stack-walk callbacks.
void toy::assertion::assertion (const char *code, const char *message, const char *fileName, const char *functionName, size_t lineNumber)
 Handles a failed assertion: formats code, message, fileName, functionName, lineNumber and invokes the registered AssertionCallback if set.
void toy::assertion::assertCompileTimeError () noexcept
 Intentionally causes a compile-time error when instantiated or evaluated in a constexpr context.

Detailed Description

Assertion system: callbacks, initialize/shutdown, and assertion() entry point.

Defines the toy::assertion namespace and assertion() entry used by assert and assert_message. In debug builds assertion() formats failure context and invokes the registered callback; in release it is a no-op. Supports optional stack-walk callback for trace output.

Note
Included by core.hpp; do not include this file directly.