News for hackers. Stuff that matters.
Re:What Programming a Game in 48 Hours Taught Me About Progr... by eliasmacpherson on Thursday August 29, 2013 @01:31PM (#6297156)
"C++ exceptions are not checked at compile-time"

are you sure about that [1][2], this is what throw() was deprecated for:

[1]http://en.cppreference.com/w/cpp/language/noexcept

[2]http://en.cppreference.com/w/cpp/language/noexcept_spec

Unless I am mistaken, on 32bit platforms exceptions incur a runtime overhead but for 64bit zero cost exceptions were developed, and only incur overhead if they are triggered [3]

[3] http://gcc.gnu.org/onlinedocs/gnat_ugn_unw/Exception-Handlin...

I think that any calls to the C library can be handled as followed in an exception safe manner unless I misunderstand you:

EDIT:( I misunderstood you, you meant wrapping resources, what follows is nonsense as a C library isn't going to throw any exception)

void library_function_wrapper()

{

  try
  {
    library_function();
  }

  catch(...)
  {

  }
}
Re:What Programming a Game in 48 Hours Taught Me About Progr... by cpeterso on Thursday August 29, 2013 @08:29PM (#6299488)
I'm not familiar with C++11's noexcept specifier, but the throw() example from [1] shows how throwing a W object is caught at run-time instead of compile-time. I think compile-time exception checking is infeasible because C++ functions without a throw() specifier might throw any exception, so the caller can't actually check at compile-time what exceptions might be thrown.

  void f() throw(X, Y) 
  {
      int n = 0;
      if (n) throw X(); // OK
      if (n) throw Z(); // also OK
      throw W(); // will call std::unexpected() at run-time, not a compile-time error
  }
[1] http://en.cppreference.com/w/cpp/language/except_spec