3ds Max C++ API Reference
Loading...
Searching...
No Matches
Assert macros

The following macros can be used in 3ds Max plug-ins to assert assumptions made by the plug-in's code. More...

Macros

#define assert(expr)   ((void *)0)
 
#define DbgAssert(expr)
 
#define DbgAssertMsg(expr, msg)
 
#define DbgVerify(expr)   ( expr )
 

Detailed Description

The following macros can be used in 3ds Max plug-ins to assert assumptions made by the plug-in's code.

Asserts are by default enabled in Debug and Hybrid builds, and are by default disabled in release builds. They can be enabled in Release builds of a plug-in by defining the MAX_ASSERTS_ACTIVE_IN_RELEASE_BUILD pre-processor symbol. One way to do this is: set CL=/DMAX_ASSERTS_ACTIVE_IN_RELEASE_BUILD They can be disabled in Hybrid and Debug builds of a plug-in by defining the MAX_ASSERTS_NOT_ACTIVE_IN_HYBRID_BUILD and MAX_ASSERTS_NOT_ACTIVE_IN_DEBUG_BUILD pre-processor symbol. One way to do this is: set CL=/DMAX_ASSERTS_NOT_ACTIVE_IN_HYBRID_BUILD

All assert macros below are equivalent. The 32 and 64 bit versions of these macros are also equivalent. The reason why several macros exist are historical... Plug-ins are encouraged to use the DbgAssert macro.

Code that needs to be compiled only when asserts are active (enabled) can be conditionally defined using MAX_ASSERT_ACTIVE. One example when this can be useful is when certain variables are used for debugging purposes only. In this case they can be conditionally declared and updated based on the MAX_ASSERT_ACTIVE symbol, and can be part of expressions that are evaluated in asserts.

#ifdef MAX_ASSERT_ACTIVE
int counter = 0;
// update counter
#endif
DbgAssert(counter != 0);
#define DbgAssert(expr)
Definition: assert1.h:83

Macro Definition Documentation

◆ assert

#define assert (   expr)    ((void *)0)

◆ DbgAssert

#define DbgAssert (   expr)

◆ DbgAssertMsg

#define DbgAssertMsg (   expr,
  msg 
)

◆ DbgVerify

#define DbgVerify (   expr)    ( expr )