|
I'm playing devils-advocate, here... By and large I do agree with your
premise, but there are sometimes exceptions to the rule that "monitor should
only be used for unexpected errors".
There are some advantages in code readability to using monitor blocks for
naturally occurring errors, however.
On 7/1/2015 3:56 PM, John Yeung wrote:
On Wed, Jul 1, 2015 at 3:11 PM, Robert Rogerson <rrogerson@xxxxxxxxxxx>
wrote:
I know that checking the divisor before doing the divide operation would
avoid this issue, but I thought this was one of the purposes of the
monitor
group.
Besides the performance, it's worth considering the code readability.
A monitor group is particularly attractive if the alternative
(checking beforehand to ensure the error condition(s) can't occur)
makes the main logic of your code much more verbose or much harder to
read.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.