BIND 10 #2466: define public static class const integral members explicitly

BIND 10 Development do-not-reply at isc.org
Tue Nov 6 17:17:49 UTC 2012


#2466: define public static class const integral members explicitly
-------------------------------------+-------------------------------------
                   Reporter:         |                 Owner:
  jinmei                             |                Status:  new
                       Type:         |             Milestone:  New Tasks
  defect                             |            Resolution:
                   Priority:         |             Sensitive:  0
  medium                             |           Sub-Project:  DNS
                  Component:         |  Estimated Difficulty:  0
  Unclassified                       |           Total Hours:  0
                   Keywords:         |
            Defect Severity:  N/A    |
Feature Depending on Ticket:         |
        Add Hours to Ticket:  0      |
                  Internal?:  0      |
-------------------------------------+-------------------------------------
Description changed by jinmei:

Old description:

> See http://bind10.isc.org/ticket/2371#comment:19
>
> In summary, if we define things like this
> {{{#!cpp
> // in foo.h
> class Foo {
> public:
>     static const int foo_const = 1;
> };
> }}}
>
> we should add its definition in the corresponding .cc:
> {{{#!cpp
> // in foo.cc
> const int foo_count; // no need for initialization; it's in the
> declaration
> }}}
>
> Note that all of "public, static, const, and integral" matter.
>
> And we should remove some workaround we did in tests, such as that for
> `Name::MAX_WIRE` in name_unittest.
>
> From a quick grep, the candidate constants are as follows:
> {{{
> bin/dhcp6/dhcp6_srv.h:    static const size_t MIN_MAC_LEN = 6;
> lib/bench/benchmark.h:    static const int TIME_FAILURE = -1;
> lib/bench/benchmark.h:    static const int ITERATION_FAILURE = -1;
> lib/datasrc/memory/zone_data.h:    static const ZoneNode::Flags
> WILDCARD_NODE = ZoneNode::FLAG_USER2;
> lib/dhcp/duid.h:    static const size_t MAX_DUID_LEN = 128;
> lib/dhcp/iface_mgr.h:    static const unsigned int MAX_MAC_LEN = 20;
> lib/dhcp/iface_mgr.h:    static const uint32_t RCVBUFSIZE = 1500;
> lib/dhcp/iface_mgr.h:    static const int INVALID_SOCKET = -1;
> lib/dhcp/option6_iaaddr.h:    static const size_t OPTION6_IAADDR_LEN =
> 24;
> lib/dhcp/option_data_types.h:    static const bool valid = false;
> lib/dhcp/option_data_types.h:    static const int len = 0;
> lib/dhcp/option_data_types.h:    static const bool valid = true;
> lib/dhcp/option_data_types.h:    static const int len = 1;
> lib/dhcp/option_data_types.h:    static const bool valid = true;
> lib/dhcp/option_data_types.h:    static const int len = 2;
> lib/dhcp/option_data_types.h:    static const bool valid = true;
> lib/dhcp/option_data_types.h:    static const int len = 4;
> lib/dhcp/option_data_types.h:    static const bool valid = true;
> lib/dhcp/option_data_types.h:    static const int len = 1;
> lib/dhcp/option_data_types.h:    static const bool valid = true;
> lib/dhcp/option_data_types.h:    static const int len = 2;
> lib/dhcp/option_data_types.h:    static const bool valid = true;
> lib/dhcp/option_data_types.h:    static const int len = 4;
> lib/dns/edns.h:    static const uint8_t SUPPORTED_VERSION = 0;
> lib/dns/labelsequence.h:    static const size_t MAX_SERIALIZED_LENGTH =
> lib/dns/message.h:    static const uint16_t DEFAULT_MAX_UDPSIZE = 512;
> lib/dns/message.h:    static const uint16_t DEFAULT_MAX_EDNS0_UDPSIZE =
> 4096;
> lib/dns/name.h:    static const size_t MAX_WIRE = 255;
> lib/dns/name.h:    static const size_t MAX_LABELS = 128;
> lib/dns/name.h:    static const size_t MAX_LABELLEN = 63;
> lib/dns/name.h:    static const uint16_t MAX_COMPRESS_POINTER = 0x3fff;
> lib/dns/name.h:    static const uint16_t COMPRESS_POINTER_MARK8 = 0xc0;
> lib/dns/name.h:    static const uint16_t COMPRESS_POINTER_MARK16 =
> 0xc000;
> lib/dns/tsigrecord.h:    static const uint32_t TSIG_TTL = 0;
> lib/log/logger.h:    static const size_t MAX_LOGGER_NAME_SIZE = 31;
> lib/log/message_initializer.h:    static const size_t MAX_MESSAGE_ARRAYS
> = 256;
> }}}

New description:

 See http://bind10.isc.org/ticket/2371#comment:19

 In summary, if we define things like this
 {{{#!cpp
 // in foo.h
 class Foo {
 public:
     static const int foo_const = 1;
 };
 }}}

 we should add its definition in the corresponding .cc:
 {{{#!cpp
 // in foo.cc
 const int foo_const; // no need for initialization; it's in the
 declaration
 }}}

 Note that all of "public, static, const, and integral" matter.

 And we should remove some workaround we did in tests, such as that for
 `Name::MAX_WIRE` in name_unittest.

 From a quick grep, the candidate constants are as follows:
 {{{
 bin/dhcp6/dhcp6_srv.h:    static const size_t MIN_MAC_LEN = 6;
 lib/bench/benchmark.h:    static const int TIME_FAILURE = -1;
 lib/bench/benchmark.h:    static const int ITERATION_FAILURE = -1;
 lib/datasrc/memory/zone_data.h:    static const ZoneNode::Flags
 WILDCARD_NODE = ZoneNode::FLAG_USER2;
 lib/dhcp/duid.h:    static const size_t MAX_DUID_LEN = 128;
 lib/dhcp/iface_mgr.h:    static const unsigned int MAX_MAC_LEN = 20;
 lib/dhcp/iface_mgr.h:    static const uint32_t RCVBUFSIZE = 1500;
 lib/dhcp/iface_mgr.h:    static const int INVALID_SOCKET = -1;
 lib/dhcp/option6_iaaddr.h:    static const size_t OPTION6_IAADDR_LEN = 24;
 lib/dhcp/option_data_types.h:    static const bool valid = false;
 lib/dhcp/option_data_types.h:    static const int len = 0;
 lib/dhcp/option_data_types.h:    static const bool valid = true;
 lib/dhcp/option_data_types.h:    static const int len = 1;
 lib/dhcp/option_data_types.h:    static const bool valid = true;
 lib/dhcp/option_data_types.h:    static const int len = 2;
 lib/dhcp/option_data_types.h:    static const bool valid = true;
 lib/dhcp/option_data_types.h:    static const int len = 4;
 lib/dhcp/option_data_types.h:    static const bool valid = true;
 lib/dhcp/option_data_types.h:    static const int len = 1;
 lib/dhcp/option_data_types.h:    static const bool valid = true;
 lib/dhcp/option_data_types.h:    static const int len = 2;
 lib/dhcp/option_data_types.h:    static const bool valid = true;
 lib/dhcp/option_data_types.h:    static const int len = 4;
 lib/dns/edns.h:    static const uint8_t SUPPORTED_VERSION = 0;
 lib/dns/labelsequence.h:    static const size_t MAX_SERIALIZED_LENGTH =
 lib/dns/message.h:    static const uint16_t DEFAULT_MAX_UDPSIZE = 512;
 lib/dns/message.h:    static const uint16_t DEFAULT_MAX_EDNS0_UDPSIZE =
 4096;
 lib/dns/name.h:    static const size_t MAX_WIRE = 255;
 lib/dns/name.h:    static const size_t MAX_LABELS = 128;
 lib/dns/name.h:    static const size_t MAX_LABELLEN = 63;
 lib/dns/name.h:    static const uint16_t MAX_COMPRESS_POINTER = 0x3fff;
 lib/dns/name.h:    static const uint16_t COMPRESS_POINTER_MARK8 = 0xc0;
 lib/dns/name.h:    static const uint16_t COMPRESS_POINTER_MARK16 = 0xc000;
 lib/dns/tsigrecord.h:    static const uint32_t TSIG_TTL = 0;
 lib/log/logger.h:    static const size_t MAX_LOGGER_NAME_SIZE = 31;
 lib/log/message_initializer.h:    static const size_t MAX_MESSAGE_ARRAYS =
 256;
 }}}

--

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


More information about the bind10-tickets mailing list