void main(void)
{
  XTRY
    case XCODE: // this is the code block
      {
        int Result = SomeFunction(7, 0);
        // continue working with Result
      }
      break;
    case DIVIDE_BY_ZERO: // handler for a specific exception
      printf("a division by zero occurred\n");
      break;
    default:             // default handler
      printf("some other error occurred\n");
      break;
    case XFINALLY:       // finally handler
      printf("cleaning up\n");
  XEND
}

Example 3: This program is functionally identical to Example 2, but the details of setting up the exception-handler block have been moved to macros XTRY and XEND.

Back to Article