quote:
Originally posted by araav
A *p;
type p. is changed to p->
type *p. is not changed. bah-bah, not good
Wait a minute. How is that a bug?
Suppose you have the following:
class Foo
{
public:
char * m_pszSomeText;
.
.
.
};
void DoSomething()
{
Foo * pObj = new Foo;
pObj->m_pszSomeText = new char[256];
*pObj->m_pszSomeText = 0; // terminate the string to zero length
}
I would not expect *pObj. to stay *pObj. when I typed the above. If I wanted to access the contents of the class pointer as a reference, then I would type (*pObj). and not *pObj..
The asterisk is a tricky devil and always applies to the last item in the descriptor, unless parens are used.