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
 Part of member is red underlined...
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

PatLuja
Tomato Guru

Belgium
416 Posts

Posted - Sep 21 2005 :  04:04:30 AM  Show Profile
Hello all,

I'm still using build 1301, because I have some deadlines in the comming month. I'm using Visual Studio.Net 2003.

In a header file I declared a member variable:
class CSomeClass* m_pModel;
In the code-file m_pModel was used a few times, before I copied a piece of code from another file into this one. This contained the variable pModel, which wasn't declared inside the piece of code I had copied. This caused pModel to be underlined in red. But also the "pModel" part of m_pModel was underlined in red.

It would be nice if m_pModel wasn't underlined at all. Now it causes confusion (and a screen with a lot of red underlined words)...
I hope you can look into this sometimes. (I don't know if it is also an issue within the new builds.)

With kind regards,
Patrick Luja

feline
Whole Tomato Software

United Kingdom
19014 Posts

Posted - Sep 21 2005 :  3:27:29 PM  Show Profile
using VS 2003, C++ and VA 1301 the quick test function:

void testVariable()
{
    char *m_pModel = "hello world";
    while(m_pModel && *m_pModel)
    {
        m_pModel++;
    }
    pModel = "fred";
}


does not show this problem. could you try inserting this into a cpp file and see what happens?

using a more sensible case, adding m_pModel into a class and then referencing both m_pModel and pModel in the class member functions does not reproduce this either.

do you have time to try these .h and cpp file that trigger this effect in a new project to see if you can reproduce this on demand? if so, would you be able to post or email a copy of the files to i can try and reproduce this?

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

jpizzi
Tomato Guru

USA
642 Posts

Posted - Sep 21 2005 :  10:54:23 PM  Show Profile
class CSomeClass* m_pModel;

What purpose does the "class" keyword serve in this declaration? It is not needed, and not common practice. Perhaps this is confusing VA?

Joe Pizzi
Go to Top of Page

PatLuja
Tomato Guru

Belgium
416 Posts

Posted - Sep 24 2005 :  06:07:50 AM  Show Profile
Hello all,

Sorry feline , I'm really busy with my deadlines, so I really don't have the time to try it out... I will do this in the near future, when there is more time.

jpizzi, I use class to avoid circular includes in header files. See the next example:

a.h:
// #include "b.h" No need to use this here
Class ClassA
{
public:
  class ClassB* m_pClassB;
  int m_A;
}

b.h:
// #include "a.h" No need to use this here
Class ClassB
{
public:
  class ClassA* m_pClassA;
  int m_B;
}

Without the class I would need to include "a.h" within the "b.h" and vice versa. With the class, I only have to include both "a.h" and "b.h" in both a.cpp and b.cpp. So ClassA and ClassB must be known when you want to use them (inside the .cpp files), not when you declare them...
(It also can come in handy to reduce the number of files to recompile when you change one little thing in a header file.)

With kind regards,
Patrick Luja
Go to Top of Page

jpizzi
Tomato Guru

USA
642 Posts

Posted - Sep 24 2005 :  6:26:33 PM  Show Profile
Oh, a combination of a forward reference and a declaration. I wonder.... Does VA have an easier time if you separate the forward reference from the declaration? It would also (arguably) increase the readability a little.

Instead of:
class ClassA
{
  class CSomeClass* m_pModel;
};
You could write:
class CSomeClass;
class ClassA
{
  CSomeClass* m_pModel;
};
It would be interesting to see if VA handled this better.

Joe Pizzi
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19014 Posts

Posted - Sep 25 2005 :  08:05:50 AM  Show Profile
for what its worth i use a lot of forward references of class names to avoid unnecessary #include's myself, and i have never had a problem like this.

i always do it the way jpizzi is showing, so this may have something to do with it.

it may be worth making this minor change when you run into this problem, to see if it helps. for now i will keep an eye out, perhaps i can reproduce this somehow.

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