Exception handling is not useful for compile-time errors.
It should NOT be used for logic errors.
It should be used for runtime errors where something is completely out of your control.
thines01
Postaholic
2,424 posts since Oct 2009
Reputation Points: 445
Solved Threads: 402
It would be MUCH better to test for zero and not divide by it than to let an exception occur. If you can predict it or prevent it, do so with code.
Exception processing is costly if your program is to continue running (doesn't just exit on the first exception).
A lot of coding is about control. The first step of maintaining control is ensure you have it in the first place :)
thines01
Postaholic
2,424 posts since Oct 2009
Reputation Points: 445
Solved Threads: 402
>>Is this the final conclusion why u asked me to test for zero rather than dividing it?
.i think so As well.
reason: Running the Try/Catch/etc., it sends the p.c. into shock Not just your tiny little app.
Hope this helps.:)
codeorder
Posting Virtuoso
1,913 posts since Aug 2010
Reputation Points: 255
Solved Threads: 384