Exception compatibility

This section describes the changes in compiler exception handling and propagation for IBM Open XL C/C++ for AIX 17.1.3 in comparison to IBM® XL C/C++ for AIX® 16.1.0 or earlier releases.

Exception handling

IBM Open XL C/C++ for AIX 17.1.3 and IBM XL C/C++ for AIX 16.1.0 that is invoked by xlclang++ generate C++ objects based on the Itanium C++ ABI.

IBM XL C/C++ for AIX 16.1.0 that is invoked by xlC and earlier releases generate C++ objects with a different C++ ABI. New and old C++ ABIs are not compatible.

If C++ objects with different C++ ABIs coexist in an application, there are limitations on exceptions thrown from objects compiled in one C++ ABI, and caught or unwound through functions compiled in a different C++ ABI.
  • If an exception that is generated from code compiled with xlC is attempted to be caught or unwound in code compiled with xlclang++ or ibm-clang++_r, the std::terminate handler is called.
  • If an exception that is generated from code compiled with xlclang++ or ibm-clang++_r is attempted to be caught in code compiled with xlC, the std::terminate handler is called.

In addition, Open XL C/C++ uses a long traceback table for exception handling, while classic XL C/C++ does not.

Exception propagation (C only)

In IBM Open XL C/C++ for AIX, the default value of the -fexceptions option is -fno-exceptions. When compiling C functions, the compiler might assume that C++ exceptions cannot propagate out of the C functions by default unless the -fexceptions option is specified.

The default behavior of IBM XL C/C++ for AIX 16.1.0 and earlier releases is same as the -fexceptions option being enabled in IBM Open XL C/C++ for AIX. By default, C++ exceptions might propagate out of C functions.