Skip to content

Commit

Permalink
Sys: Wherein Matt gives up on C++, and eradicates it from error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
knepley committed Jan 5, 2014
1 parent 98c3741 commit cabecf0
Showing 1 changed file with 0 additions and 22 deletions.
22 changes: 0 additions & 22 deletions src/sys/error/err.c
Expand Up @@ -289,28 +289,6 @@ PetscErrorCode PetscErrorMessage(int errnum,const char *text[],char **specific)
PetscFunctionReturn(0);
}

#if defined(PETSC_CLANGUAGE_CXX)
/* C++ exceptions are formally not allowed to propagate through extern "C" code. In practice, far too much software
* would be broken if implementations did not handle it it some common cases. However, keep in mind
*
* Rule 62. Don't allow exceptions to propagate across module boundaries
*
* in "C++ Coding Standards" by Sutter and Alexandrescu. (This accounts for part of the ongoing C++ binary interface
* instability.) Having PETSc raise errors as C++ exceptions was probably misguided and should eventually be removed.
*/
#include <sstream>
static void PetscCxxErrorThrow() {
const char *str;
if (eh && eh->ctx) {
std::ostringstream *msg;
msg = (std::ostringstream*) eh->ctx;
str = msg->str().c_str();
} else str = "Error detected in C PETSc";

throw std::exception(str);
}
#endif

#undef __FUNCT__
#define __FUNCT__ "PetscError"
/*@C
Expand Down

0 comments on commit cabecf0

Please sign in to comment.