GL Studio C++ Runtime API
disti_assert.h File Reference

Contains the DistiAssert macro. More...

#include "disti_include.h"
#include "gls_cpp_lang_support.h"
#include <stddef.h>

Go to the source code of this file.

Classes

class  DistiException
 

Namespaces

 disti
 

Macros

#define GLS_ASSERT(exp)
 
#define GLS_VERIFY(exp)   (void)( ( exp ) || ( ::disti::GlsVerify( #exp, __FILE__, __LINE__ ), 0 ) )
 

Typedefs

typedef void(* DistiAssertHandler) (const char *errMessage)
 

Functions

void DistiAssertDebug (const char *expression, const char *filename, unsigned int lineNumber)
 
void DistiAssertRelease (const char *expression, const char *filename, unsigned int lineNumber)
 
void GlsVerify (const char *expression, const char *filename, unsigned int lineNumber)
 
void GlsAssert (const char *expression, const char *filename, unsigned int lineNumber)
 
template<class T >
T * ValidatePointer (const T *const p)
 

Detailed Description

Contains the DistiAssert macro.

Copyright Information

Copyright (c) 2017 by The DiSTI Corporation.
11301 Corporate Blvd., Suite 100
Orlando, Florida 32817
USA

All rights reserved.

This Software contains proprietary trade secrets of DiSTI and may not be reproduced, in whole or part, in any form, or by any means of electronic, mechanical, or otherwise, without the written permission of DiSTI. Said permission may be derived through the purchase of applicable DiSTI product licenses which detail the distribution rights of this content and any Derivative Works based on this or other copyrighted DiSTI Software.

NO WARRANTY. THE SOFTWARE IS PROVIDED "AS-IS," WITHOUT WARRANTY OF ANY KIND, AND ANY USE OF THIS SOFTWARE PRODUCT IS AT YOUR OWN RISK. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, DISTI AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE.

LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL DISTI OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE THE SOFTWARE, EVEN IF DISTI HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. DISTI'S ENTIRE LIABILITY AND YOUR EXCLUSIVE REMEDY SHALL NOT EXCEED FIVE DOLLARS (US$5.00).

The aforementioned terms and restrictions are governed by the laws of the State of Florida and the United States of America.

Macro Definition Documentation

#define GLS_ASSERT (   exp)
Value:
do \
{ \
(void)( ( exp ) || ( ::disti::GlsAssert( #exp, __FILE__, __LINE__ ), 0 ) ); \
} while( 0 )
void GlsAssert(const char *expression, const char *filename, unsigned int lineNumber)

In builds where GLS_DEBUG is defined OR where NDEBUG is not defined, this macro has the following behavior:

  1. If a callback is registered with SetGlsAssertHandler(), that handler is invoked when an assertion fails (exp is false).
  2. If no handler is registered and the assertion fails, on Windows GLS_ASSERT will popup a message box allowing the user to Abort, Retry (Debug), or Ignore the error. Retry will cause a User breakpoint on the error, Abort will throw a DistiException describing the error, and Ignore does nothing.

If none of the aforementioned symbols are defined, this function does nothing, and does not evaluate exp.

Note
Use this function instead of the deprecated DistiAssert() macro for checks that should be tested in Debug builds only.
#define GLS_VERIFY (   exp)    (void)( ( exp ) || ( ::disti::GlsVerify( #exp, __FILE__, __LINE__ ), 0 ) )

The GLS_VERIFY() macro has the following behavior:

  1. If a callback is registered with SetGlsVerifyHandler(), that handler is invoked when exp is false.
  2. If no handler is registered and the exp is false, on Windows GLS_VERIFY() will popup a message box allowing the user to Abort, Retry (Debug), or Ignore the error. Retry will cause a User breakpoint on the error, Abort will throw a DistiException describing the error, and Ignore does nothing.
Note
Use this function instead of the deprecated DistiAssert() macro for checks that should be tested in both Debug and Release builds.