Axiom 1: Exceptions Are Synchronous
First, note that exceptions are synchronous and can occur only at the boundary of a function call. Therefore, operations like arithmetic on predefined types, assignment of predefined types (especially pointers), and other low-level operations will not result in an exception. (They could result in a signal or interrupt of some sort, but these are not exceptions.)
Operator overloading and templates complicate this situation, since it's often difficult to determine whether a given operation will result in a function call and potential exception. For example, if I assign character pointers, I know I won't get an exception, whereas if I assign user-defined Strings, I might:
const char *a, *b;
String c, d;
//...
a = b; // no function call, no exception
c = d; // function call, maybe an exception
With templates, things become less definite:
template <typename T>
void aTemplateContext() {
T e, f;
T *g, *h;
//...
e = f; // function call? exception?
g = h; // no function call, no exception
//...
}
Because of this uncertainty, all potential function calls within a template must be assumed to be actual function calls, and this includes infix operators, implicit conversions, and so on.
|