On 31 March 2010 08:25, Bart Van Assche <[email protected]> wrote:
>> MF> #ifndef INT32_MAX
>> MF> #define INT32_MAX 0x7fffffff
>> MF> #endif

> It seems like some context information got lost in this discussion. The
> constant in 0x7fffffff in the source file agent/mibgroup/ucd-snmp/disk.c
> ... [refers] to the largest value
> representable by the SNMPv2-SMI type Integer32

> This also means that the above #ifndef / #endif construct is not correct: it
> will cause the code in agent/mibgroup/ucd-snmp/disk.c not to limit long_ret
> to the range 0 .. 0x7fffffff on systems where sizeof(int) == 8.

Are you sure?

Checking the one 64-bit system I have access to, the system defines
in <stdint.h> include the following

# define INT32_MAX              (2147483647)
# define INT64_MAX              (__INT64_C(9223372036854775807))
# define UINT32_MAX             (4294967295U)
# define UINT64_MAX             (__UINT64_C(18446744073709551615))

These are in decimal, rather than hex, but the two 32-bit constants
equate to 0x7FFFFFFF and 0xFFFFFFFF  respectively.
So the masking would be the same, regardless of whether the
constant comes from the system header file, or a local definition.

Are you aware of a system where {U,}INT32_MAX have different
values to this?

Dave

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to