载入中...
搜索中...
未找到
Assert.h 文件参考

EVEngine assertion entry point, backed by zeroerr. 更多...

#include "zeroerr/assert.h"

浏览源代码.

宏定义

#define EV_PARAM_CHECK(cond, ...)   ASSERT(cond, ##__VA_ARGS__)
 Validate a function parameter / public API precondition.
 
#define EV_ASSERT(cond, ...)   ASSERT(cond, ##__VA_ARGS__)
 Assert an internal engine invariant (state that must always hold).
 

详细描述

EVEngine assertion entry point, backed by zeroerr.

All parameter validation and internal invariant checks in the engine should go through the macros defined here (or use zeroerr's ASSERT family directly).

Build policy:

  • Debug builds: checks are compiled in and always active.
  • Release / other configurations: checks are compiled out by default (CMake defines ZEROERR_NO_ASSERT), so there is zero runtime cost.
  • To force checks on in non-Debug builds, configure with -DEVENGINE_ENABLE_ASSERTS=ON (or make ... CMAKE_EXTRA_ARGS=-DEVENGINE_ENABLE_ASSERTS=ON).

A failed check throws zeroerr::AssertionData (a std::exception) carrying the file, line, decomposed expression and an optional message.

在文件 Assert.h 中定义.

宏定义说明

◆ EV_ASSERT

#define EV_ASSERT (   cond,
  ... 
)    ASSERT(cond, ##__VA_ARGS__)

Assert an internal engine invariant (state that must always hold).

参数
condThe boolean invariant that must hold.
...Optional message printed when the check fails.

在文件 Assert.h37 行定义.

◆ EV_PARAM_CHECK

#define EV_PARAM_CHECK (   cond,
  ... 
)    ASSERT(cond, ##__VA_ARGS__)

Validate a function parameter / public API precondition.

参数
condThe boolean precondition that must hold.
...Optional message printed when the check fails (plain text, printf-style pattern supported by zeroerr::format).

在文件 Assert.h30 行定义.