On Mon, 2008-03-17 at 10:29 -0400, King Dark wrote:
By the way, the "try catch" seems cannot catch the exception such as "divided by zero". It crushed after running such code.
Although your aforementioned problem appears relatively legitimate, attempting to catch an exception resulting from division by zero is a terribly bad practice. Try testing to see if the input value (the untrusted value) is non-zero first instead. This is what reasonable programs do (kind of like testing for an object being null before calling a method on it, rather than trying to catch and handle the exception which results from calling a method on a null value).
Cheers,
Scott S. McCoy