Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 . to ->
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

araav
Senior Member

Armenia
28 Posts

Posted - Mar 07 2005 :  03:51:42 AM  Show Profile  Reply with Quote
A *p;
type p. is changed to p->
type *p. is not changed. bah-bah, not good

feline
Whole Tomato Software

United Kingdom
18942 Posts

Posted - Mar 07 2005 :  4:17:46 PM  Show Profile  Reply with Quote
any chance i can get away with "shame on you for using hard to read code"?

case=524

zen is the art of being at one with the two'ness
Go to Top of Page

support
Whole Tomato Software

5566 Posts

Posted - Apr 14 2006 :  11:26:38 PM  Show Profile  Reply with Quote
Fixed in build 1445.
Go to Top of Page

ether
Tomato Guru

USA
130 Posts

Posted - Apr 17 2006 :  07:19:00 AM  Show Profile  Reply with Quote
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.

Edited by - ether on Apr 17 2006 07:20:11 AM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18942 Posts

Posted - Apr 17 2006 :  12:34:08 PM  Show Profile  Reply with Quote
have a look at this thread, the code example is a good explanation of when this is a bug:

http://forum.wholetomato.com/forum/topic.asp?TOPIC_ID=3433

personally i agree, using * like this is a bad idea if you want clear and easy to read code. the multiplication example is a better example of why VA should handle this slightly differently.

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000