3

C++: Typedefs and Exceptions

view full story
linux-howto

http://www.linuxquestions.org – Okay... little paranoid here in the early stages of a project... wanted to make sure I understand this correctly: If I create a new type with typedef, and I set a catch statement to receive that new type, the catch statement will only receive that type, correct? That is, it won't receive the type which the typedef is aliases, correct? Code: // **************** // * In header file: typedef int ErrorCont; // **************** // * in source file: bad_function() throws(int) {   int x = 1;   throw x; } // **************** // * in source file: int main() {   try {     bad_function();   } catch (ErrorCont) {     // The int shouldn't get caught here, right?   } } My tests seem to confirm this... but wanted to get a second opinion before building an entire exception handling schema around this. (HowTos)