× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On Wed, Jul 1, 2015 at 6:31 PM, Scott Klement <rpg400-l@xxxxxxxxxxxxxxxx> wrote:
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".

Actually, my FIRST premise was that monitor groups are desirable if
they help readability.

There are some advantages in code readability to using monitor blocks for
naturally occurring errors, however.

I'll just quote myself again:

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.

Nice to know I'm on the same page as Scott Klement.

John Y.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.