[AGENT++] Does the counter datatype in SNMP++ wrap?

Jochen Katz katz at agentpp.com
Sat Feb 4 00:09:39 CET 2006


Hi,

> Does the counter datatype wrap on reaching the maximum value? Also from the
> interface available for Counter datatype in SNMP++ - it looks like I can set
> it to any value using the replace_value method (ie increment or decrement
> it)- is this understanding of mine correct?

the 32 bit classes wrap around like any other (unsigned) int/long.
But the Counter64 seems to make problems, it only works for increments of 1.

I'm now wondering why HP used "long double" for doing the calculations.
I would expect that a compiler that has a long double also has a 64 bit
integer. Can anyone comment on this?

As snmp++ already uses a 64 bit integer, I think I will change the
Counter64 class to use this type.

Regards,
  Jochen

// Define a unsigned 64 bit integer:
#ifdef WIN32
#include <windows.h>
#ifdef __BCPLUSPLUS__
typedef unsigned __int64 pp_uint64;
#else
typedef ULONGLONG pp_uint64;
#endif
#else // not WIN32
typedef unsigned long long pp_uint64;
#endif




More information about the AGENTPP mailing list