The following macros can be used in 3ds Max plug-ins to assert assumptions made by the plug-in's code.
Asserts are always enabled in Debug and Hybrid builds, and by default are 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
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 conditionaly 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.
Macros | |
#define | assert(expr) ( (expr) || assert1( __LINE__, _M(__FILE__), _3DSMAX_CURRENT_FUNCTION_, (_M(#expr)) ) ) |
#define | DbgAssert(expr) (void((expr) || assert1( __LINE__, _M(__FILE__), _3DSMAX_CURRENT_FUNCTION_, (_M(#expr))))) |
#define | DbgVerify(expr) ( (expr) || (assert1( __LINE__, _M(__FILE__), _3DSMAX_CURRENT_FUNCTION_, (_M(#expr))), false) ) |
#define assert | ( | expr | ) | ( (expr) || assert1( __LINE__, _M(__FILE__), _3DSMAX_CURRENT_FUNCTION_, (_M(#expr)) ) ) |
#define DbgAssert | ( | expr | ) | (void((expr) || assert1( __LINE__, _M(__FILE__), _3DSMAX_CURRENT_FUNCTION_, (_M(#expr))))) |
#define DbgVerify | ( | expr | ) | ( (expr) || (assert1( __LINE__, _M(__FILE__), _3DSMAX_CURRENT_FUNCTION_, (_M(#expr))), false) ) |