Hacker News new | ask | show | jobs
by makecheck 5304 days ago
Not just longjmp and goto, but Objective-C's @throw.

As much as I'm a fan of RAII in C++, it really is a "pure C++" idiom. If a C++ class is needed in Objective-C code that can @throw an NSException, then the C++ cleanup code really has to be invocable explicitly (because the destructor might not be called). For example:

  MyCPlusPlusObject object;
  @try
  {
    ...
  }
  @finally
  {
    object.cleanup();
  }