IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 27, 2007, 8:51:23 AM (19 years ago)
Author:
magnier
Message:

adding a generic PS_ASSERT macro to catch known programming errors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/sys/psAssert.h

    r12433 r12596  
    1212#include "psError.h"
    1313#include "psLogMsg.h"
     14
     15// these two asserts can be used in the middle of a function to test for programming errors
     16#define PS_ASSERT(VAR, RVAL) \
     17if (!(VAR)) { \
     18    psError(PS_ERR_PROGRAMMING, false, "Error: %s is not true.", #VAR); \
     19    return(RVAL); \
     20}
    1421
    1522// Ensure this is a psLib pointer, by checking for the memblock bounds.
     
    3542}
    3643
     44#define PS_ASSERT_INT_UNEQUAL(NAME1, NAME2, RVAL) \
     45if ((NAME1) == (NAME2)) { \
     46    psError(PS_ERR_BAD_PARAMETER_VALUE, true, \
     47            "Error: %s and %s are equal.", \
     48            #NAME1, #NAME2); \
     49    return(RVAL); \
     50}
     51
    3752#define PS_ASSERT_INT_EQUAL(NAME1, NAME2, RVAL) \
    3853if ((NAME1) != (NAME2)) { \
Note: See TracChangeset for help on using the changeset viewer.