mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
Added class for catching C++ exceptions. When using libobjc2, you can catch C++ exceptions by writing @catch(CXXException *e). This will wrap the C++ exception in an Objective-C object and allow you to access it by sending a -thrownValue message to the object. This returns a pointer to the exception. For example, if the exception is an integer, you would retrieve it like this from Objective-C:
@catch(CXXException *e) { int i = *(int*)[e thrownValue]; } In ObjC++, you can also make sure that it really is an int, by doing: assert(typeid(int) == *(std::type_info*)[e cxx_type_info]); These interfaces are experimental and subject to change without notice. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30904 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
c7ef614806
commit
edcd8d0c5d
3 changed files with 108 additions and 0 deletions
|
@ -146,6 +146,7 @@ GNU_HEADERS = $(ADD_HEADERS)
|
|||
# GNUStep source files
|
||||
|
||||
BASE_MFILES = \
|
||||
CXXException.m\
|
||||
GSArray.m \
|
||||
GSAttributedString.m \
|
||||
GSConcreteValue.m \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue