next up previous contents index
Next: Byte Order: ntohs Up: Utility Routines Previous: Time

Panic Conditions

xAssert

 

If the expression exp evaluates to FALSE, the x-kernel will print a message and halt.

xAssert(bool exp)

Note that xAssert statements are macros which are only active in DEBUG mode (see Section 12). In OPTIMIZE mode, xAssert and trace statements go away completely. You should keep this in mind to avoid bugs that show up only in OPTIMIZE mode. For example, the statment:

      xAssert(mapResolve(map, key, &p) == XK_SUCCESS);

will have no effect in OPTIMIZE mode. You should be careful to separate the operation and the check of the return code, as follows.

      res = mapResolve(map, key, &p);
      xAssert(res == XK_SUCCESS);

xError

 

Non-fatal error conditions can print warnings even in nondebugging mode by using the xError call.

xError(char *ErrorString)



Larry Peterson
Tue Jul 1 14:50:34 MST 1997