Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QM handling of C declarations
#2
You probably saw QM help topic "Pointer, reference, array".

Differences of pointer usage in C/C++ and QM:
1. To access members of user-defined type (struct) through pointer, in C/C++ you write pointer->member. In QM - pointer.member.
2. QM does not have pointer arithmetic. C/C++ expression pointer+1 in QM must be pointer+sizeof(TYPE). But array access is the same - pointer[i].
3. In C/C++ pointer variables are often declared like int *p. It is the same as int* p (like in QM) when declaring single pointer. When multiple, in C/C++ you write int *p1, *p2.... In QM - int* p1 p2 (in C/C++ p2 would be not pointer).
4. Very often need to cast pointer type. In C/C++ it is TYPE1* p1=...; TYPE2* p2=(TYPE2*)p1. In QM you use operator + instead of (TYPE2*), like TYPE1* p1=...; TYPE2* p2=+p1.
5. QM is less strict, for example in your callback can be MIB_IPINTERFACE_ROW&Row (reference instead pointer, which is physically the same). Unless Row is an array, not a pointer to a single variable.
6. Don't remember now. Your questions can help to continue this list.

Your code is correct.

> So i must declare a new MIB_IPINTERFACE_ROW, get Family, InterfaceLuid and InterfaceIndex from Row into it, then pass it to GetIpInterfaceEntry to get information.
Exactly. if(Row!=0) MIB_IPINTERFACE_ROW r2; r2.Family=Row.Family...


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)