Macro Example
List of: Discussion Topic
Subjects: Error Handling
Contents: Application Development Manual

Without exception handling:

ENTITY_LIST list;


// Local instance with dynamic








// memory
...
EDGE *ent = new EDGE(...);
// ENTITY handled by BB mechanism
list.add(ent);
...
double *dbls = new double[n]; // Temporary memory
...
delete [] dbls;

With exception handling:

EXCEPTION_BEGIN
ENTITY_LIST list;
double *dbls = NULL;
EXCEPTION_TRY
...
EDGE *ent = new EDGE(...);
list.add(ent);
...
dbls = new double[n];
...
EXCEPTION_CATCH(TRUE)
delete [] dbls;
EXCEPTION_END

A parallel set of C_EXCEPTION_. . . macros is defined in except.h for use in C code. Due to the lack of constructors/destructors, local variables cannot be automatically cleaned up. Also, any statement (return, break, continue, goto) that would transfer control outside the EXCEPTION_BEGIN/EXCEPTION_END block should not be used.
PDF/APPDEV/06ERR.PDF
HTM/DATA/ACIS/APPDEV/06ERR/0004.HTM