BIND 10 #1748: define AbstractRRset::isSameKind() and implement the default version

BIND 10 Development do-not-reply at isc.org
Mon Mar 12 18:16:47 UTC 2012


#1748: define AbstractRRset::isSameKind() and implement the default version
-------------------------------------+-------------------------------------
                   Reporter:         |                 Owner:  muks
  jinmei                             |                Status:  reviewing
                       Type:  task   |             Milestone:
                   Priority:  high   |  Sprint-20120320
                  Component:         |            Resolution:
  libdns++                           |             Sensitive:  0
                   Keywords:         |           Sub-Project:  DNS
            Defect Severity:  N/A    |  Estimated Difficulty:  3
Feature Depending on Ticket:  auth   |           Total Hours:  0
  performance                        |
        Add Hours to Ticket:  0      |
                  Internal?:  0      |
-------------------------------------+-------------------------------------

Comment (by jinmei):

 Replying to [comment:9 stephen]:

 Just happen to notice this via email...

 > However, since the return value is boolean, and since each comparison
 generates a boolean value that can be combined with the other values via
 logical operators, I suggest that the following is clearer:
 > {{{
 > bool
 > AbstractRRset::isSameKind(const AbstractRRset& other) const {
 >     return (getName() == other.getName() &&
 >             getType() == other.getType() &&
 >             getClass() == other.getClass());
 > }
 > }}}
 > (As the expressions are evaluated left to right and not evaluated if the
 result of the expression becomes known during earlier evaluations, it will
 be more efficient to check "class" last.  Most of the time everything is
 the same class, so the name or type not matching is more probable than the
 class not matching.)

 I'd compare the types first, because comparing names is more
 expensive.  I think comparing the classes last makes sense.  I'd also
 make an explicit comment about why we compare these in that specific
 order.

-- 
Ticket URL: <http://bind10.isc.org/ticket/1748#comment:10>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development


More information about the bind10-tickets mailing list