On Wed, Mar 31, 2010 at 4:16 AM, Wes Hardaker <
[email protected]> wrote:

> >>>>> On Tue, 30 Mar 2010 21:32:57 +0200, Magnus Fromreide <
> [email protected]> said:
>
> MF> b) I would probably prefer the following since it makes sense to use
> MF> a well known name and this define is located in an implementation
> MF> file.
>
> MF> #ifndef INT32_MAX
> MF> #define INT32_MAX 0x7fffffff
> MF> #endif
>
> There is even precedence for it.  See line 198 of snmplib/asn1.c.
>
> I actually wonder if we should move that sort of thing to
> include/net-snmp/types.h instead.
>

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
does not refer to the largest number that can be stored in a variable of the
type int of the C programming language but to the largest value
representable by the SNMPv2-SMI type Integer32 (see also
mibs/UCD-DISKIO-MIB.txt). So an SMI- or ASN-related header might be a better
choice than include/net-snmp/types.h.

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.

Bart.
------------------------------------------------------------------------------
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