next up previous contents index
Next: xError Up: Panic Conditions Previous: 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);



Larry Peterson
Wed Jan 10 10:40:08 MST 1996