Math API nvidia_logo_transpbg.gif Up
Base API Configuration Options

Base API Configuration Options for Assertions

The base API supports quality software development with assertions. They are contained in various places in the Base API include files.

These tests 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_base_assert and mi_base_assert_msg before including the relevant include files. Defining only one of the two macros is considered an error. These macros and their parameters have the following meaning:

  • 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.
  • mi_base_assert_msg(expr, msg): Same behavior as mi_base_assert(expr), but 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.

See Base API Assertions .

Base API Configuration Options for STL Use

Base API makes occasionally use of Standard Template Library (STL) headers, classes, and functions. This behavior can be customized with the following macro:

  • MI_BASE_NO_STL: The base API will not include any STL header and it will not use any STL classes not functions. Instead it will add missing class and function definitions to its own namespace, for example min and max function templates.

    Note: The base API still includes a few standard C++ headers, for example cstddef and cmath.

The base API locates classes and functions from the standard library in the namespace scope MISTD. It is by default set as a namespace alias to point to the namespace std. This behavior can be customized with the following macros:

  • MI_BASE_STD_NAMESPACE: This macro has to expand to a valid namespace scope that contains the standard library classes and functions. It is used for the namespace alias MISTD instead of the default std.
  • MI_BASE_NO_MISTD_ALIAS: If this macro is defined, the namespace alias definition for MISTD is suppressed. This can be used if the standard library classes and functions have been configured to live already in the MISTD namespace.