On 29 October 2012 11:56, Sverre Moe <sve...@spacetec.no> 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 Net-snmp-users@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users