[AGENT++] Consts in SNMP++

Frank Fock fock at agentpp.com
Tue Feb 10 20:46:12 CET 2004


Hi Marek,

Unfortunately, the original v2.x of SNMP++ did not use const at all
(or only accidentially). The reason for it were some internal needs at
HP. Peter Mellquist wrote me, that they otherwise had some compilation
problems with existing applications.

Since SNMP++v2.x seems to be a dead end these days, I do not think
that we have to worry about those SNMP++v2.x users. That's why
Jochen has already made most of the const methods const. Obviously,
we missed some of those. So thanks for your hints, we will try to fix them.

Best regards,
Frank

Marek Malowidzki wrote:

>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
>
>_______________________________________________
>AGENTPP mailing list
>AGENTPP at agentpp.org
>http://agentpp.org/mailman/listinfo/agentpp
>
>  
>






More information about the AGENTPP mailing list