neuray API Programmer's Manual

Neuray API Assertions

[Neuray API]

Description

Assertions.

Include File:

#include <mi/neuraylib/assert.h>

Neuray API supports quality software development with assertions. They are contained in various places in the neuray API include files.

These tests are mapped to corresponding base API assertions by default, which in turn are switched off by default to have the performance of a release build. To activate the tests, you need to define the two macros mi_neuray_assert and mi_neuray_assert_msg, or correspondingly the mi_base_assert and mi_base_assert_msg macros, before including the relevant include files. Defining only one of the two macros is considered an error.

See also mi_math_intro_config and mi_base_intro_config in general.

Defines

#define mi_neuray_assert( expr) mi_base_assert(expr)
If expr evaluates to true this macro shall have no effect. More...
#define mi_neuray_assert_msg( expr, msg)
If expr evaluates to true this macro shall have no effect. More...

Defines

#define mi_neuray_assert( expr) mi_base_assert(expr)

If expr evaluates to true this macro shall have no effect. If expr evaluates to false this macro may print a diagnostic message and change the control flow of the program, such as aborting the program or throwing an exception. But it may also have no effect at all, for example if assertions are configured to be disabled.

By default, this macro maps to mi_base_assert, which in turn does nothing by default. You can (re-)define this macro to perform possible checks and diagnostics within the specification given in the previous paragraph.

See also:

mi_math_intro_config, mi_base_intro_config

#define mi_neuray_assert_msg( expr, msg)

If expr evaluates to true this macro shall have no effect. If expr evaluates to false this macro may print a diagnostic message and change the control flow of the program, such as aborting the program or throwing an exception. But it may also have no effect at all, for example if assertions are configured to be disabled.

the msg text string contains additional diagnostic information that may be shown with a diagnostic message. Typical usages would contain "precondition" or "postcondition" as clarifying context information in the msg parameter.

By default, this macro maps to mi_base_assert_msg, which in turn does nothing by default. You can (re-)define this macro to perform possible checks and diagnostics within the specification given in the previous paragraph.

See also:

mi_math_intro_config, mi_base_intro_config

Value

mi_base_assert_msg(expr, msg)