Function Macro

GLibassert

Declaration [src]

#define g_assert (
  expr
)

Description [src]

Debugging macro to terminate the application if the assertion fails.

If the assertion fails (i.e. the expression is not true), an error message is logged and the application is terminated.

The macro can be turned off in final releases of code by defining G_DISABLE_ASSERT when compiling the application, so code must not depend on any side effects from expr. Similarly, it must not be used in unit tests, otherwise the unit tests will be ineffective if compiled with G_DISABLE_ASSERT. Use g_assert_true() and related macros in unit tests instead.

This function is not directly available to language bindings.

Parameters

expr

Type: -

The expression to check.