kk <[EMAIL PROTECTED]> writes: > char *str = 0; > > try > { > // int i = 0; > // int j = 1/i; // Uncommenting this would not go into > catch block. But gives "Floating Point Exception"
Division by 0 is undefined behavior. A platform may transform it into an exception, but that certainly isn't a requirement. > strstr(str,"hello"); // str is NULL -> exception! Passing 0 here is undefined behavior. A platform ... In both cases, the program is in an invalid state after the attempted operation, and IMHO, anything but immediate termination of the program is (at least) weird. > Similar code was tried using VC++ on a windows system. It works. i.e, > control does move to the catch block and execute as expected. But in general, there is no telling how the program will behave. _______________________________________________ help-gplusplus mailing list help-gplusplus@gnu.org http://lists.gnu.org/mailman/listinfo/help-gplusplus