z/OS Language Environment Writing Interlanguage Communication Applications
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


C to C++ condition handling

z/OS Language Environment Writing Interlanguage Communication Applications
SA38-0684-00

C++ exception handling uses throw()/try()/catch(), whereas C uses signal()/raise() or sigaction()/kill(). Mixing C and C++ exception handling in a C to C++ ILC module will result in undefined behavior. If you use only the C exception handling model, a C++ routine can register a signal handler via signal to handle exceptions (software/hardware) raised by either a C or C++ routine. However, the behavior of running destructors for static/automatic objects is undefined.

If you use only the C++ exception handling model, only C++ routines will be able to catch()/handle() thrown objects. C routines do not have try()/catch()/throw() abilities nor can they use signal() to register a handler for thrown objects. A C++ routine cannot register a handler via signal() to catch thrown objects; it must use catch() clauses. C routines will ignore thrown objects.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014