how to read the following code

Can anyone help me decipher/read the following code so that I can explain it to myself in simple English? :)

Thanks!

if (Sp->m_RecPairGroupList.CurHead()){
ConvLine* pLine;
more = true; // get it started
while (more) {
pLine = g_pStoreBase->FindMachDst(Sp->m_RecPairGroupList.curData()->Grp);
if (pLine && pLine->IsA(MACHDST)) {
((MachDstLine*)pLine)->SetCanReceivePairedLoads(true);
}
pLine = g_pStoreBase->FindProcDst(Sp->m_RecPairGroupList.curData()->Grp);
if (pLine && pLine->IsA(PROCDST)) {
((ProcDstLine*)pLine)->SetCanReceivePairedLoads(true);
}
more = Sp->m_RecPairGroupList.CurNext();
This code could as easily do nothing as it could re-elect G.W. Bush or insult your grandma. Without further information and the assumption that the names are not intentionally confusing nothing can be said about it.
my bad...I guess I should've thought more about my question before posting it on the forum...

the question I really meant to ask is...what does the symbol (->) indicate or imply when it's used before a function or in the following statements?

Sp->m_RecPairGroupList.CurHead()

pLine = g_pStoreBase->FindMachDst(Sp->m_RecPairGroupList.curData()->Grp);

if (pLine && pLine->IsA(MACHDST))

..I hope this is a more useful way to get my question out there...

thanks!
When accessing a method or member on an object you need to use an accessor. Depending on the variable type the accessor will change.

. is used for objects that are local
-> is used for pointers to objects
Thanks Zaita! I appreciate your help with this...getting a handle on how to read the different types of operators/symbols has been a slow process.
Just to expand the the comment by Zaita with an example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
class myclass
{
   void mymethod(int var)
   {
      m_var = var;
   }

   int m_var;
};

int main()
{
   myclass *ptr = new myclass();
   myclass var;

   ptr->mymethod(1);
   //is equivalent to
   var.mymethod(1);

   delete ptr;

   return 0;
}
Topic archived. No new replies allowed.