[AGENT++] Consts in SNMP++

Marek Malowidzki malowidz at wil.waw.pl
Tue Feb 10 11:56:35 CET 2004


Hi,

I believe that the following member functions should be declared as 'const'
in SNMP++:

SnmpTarget::operator==() (as well as the == operators in CTarget and
UTarget)
SmiInt32::operator long()
SmiUInt32::operator unsigned long()
Address::get_length() (and, since this is a virtual function, in all
deriving classes)
Address::get_ip_version()

The following functions should have 'const&' arguments:

Counter64: all friend comparison operators should take const Counter64& as
arguments
Pdu::operator+= should have 'const Vb&' argument

Also, is there a reason for Snmp::get()/set() etc. not to declare the
'target' parameter as const&? I also seem that it is not modified (and it
rather should not be).

I know that these changes may be painful but they are indeed important,
since the consistent usage of 'const' allows to separate functions that
change the object from real 'const' ones (as friendly_name(), for example,
which should be locked in a MT environment).

Marek




More information about the AGENTPP mailing list