Re: Debugging SNMP

Dave Shield <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <CAKoMtGYVmb8-uZmmV0_Ce-nARAcXjTdJG59xvYcO+P2oWKJWUg@mail.gmail.com>
On 29 October 2012 11:56, Sverre Moe <[email protected]> wrote:
> Why does this work for my 3 hard coded scalars, but not my list of scalars?
>
> const oid scalar_oid[] = { 1,3,6,1,4,1,45678,1,1 };
> OID_LENGTH(scalar_oid) gives value 9.
>
> const oid *scalar_oid = wrapper.getOid(); //Has same oid within. Returns a
> pointer to an oid.
> OID_LENGTH(scalar_oid) gives value 1.
>
> Both of these is just a pointer right?

No.

The first case is an array,
    so sizeof(scalar_oid) gives 36 (assuming a 32-bit system),
    and hence  OID_LENGTH gives 9
            (sizeof(scalar_oid)/sizeof(oid))

The second case is a pointer,
    so sizeof(scalar_oid) gives 4 (again, assuming a 32-bit system)
    and hence  OID_LENGTH gives 1
            (sizeof(scalar_oid)/sizeof(oid))

Glad you got things sorted.

Dave

------------------------------------------------------------------------------
The Windows 8 Center - In partnership with Sourceforge
Your idea - your app - 30 days.
Get started!
http://windows8center.sourceforge.net/
what-html-developers-need-to-know-about-coding-windows-8-metro-style-apps/
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.