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
 List Methods shows Constructor multiple times
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Kram
Junior Member

Germany
13 Posts

Posted - Oct 08 2021 :  11:04:09 AM  Show Profile  Reply with Quote
Hello,

The constructor for the class show up multiple times in the List of Methods in Current File drop-down.


namespace test_3
{
    class c
    {
        c() noexcept :
            m1(1),
            m2(2),
            m3(3)
        {
        }
        int m1;
        int m2;
        int m3;
    };
}



B00ting, please wait...

feline
Whole Tomato Software

United Kingdom
17503 Posts

Posted - Oct 08 2021 :  11:33:24 AM  Show Profile  Reply with Quote
That is a bit odd. I am not getting that bug here though. If you go to the duplicate "c" entries do they all take you to the same place?

If you place just this test code into a new, empty code file, do you see the same problem? I am wondering if something further up the file is a factor, which would explain why we are getting different results.

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

Kram
Junior Member

Germany
13 Posts

Posted - Oct 08 2021 :  12:51:40 PM  Show Profile  Reply with Quote
I have checked and it's due to other code. The issue is that the classes exist in different namespaces in the same source file. They are in fact different classes, but as the list items are not prefixed with a namespace they look duplicated.

B00ting, please wait...
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17503 Posts

Posted - Oct 08 2021 :  1:02:10 PM  Show Profile  Reply with Quote
That makes sense, and would explain what you are seeing. If you right click on the open Alt-M list you can turn Off:

Reduce display of namespace scopes

so that namespaces will be shown, which will help when you have several namespaces in the same file.

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

Kram
Junior Member

Germany
13 Posts

Posted - Oct 08 2021 :  1:35:41 PM  Show Profile  Reply with Quote
I already have that on. This helps for the current item that is shown, but not the drop-down list.
It would be useful if the namespace was included in the drop-down.

B00ting, please wait...
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17503 Posts

Posted - Oct 11 2021 :  08:59:22 AM  Show Profile  Reply with Quote
I don't understand what you mean. Using C++, I have added the following code to a cpp file:

namespace test_1
{
	class c
	{
		c() { }
	};
}

namespace test_2
{
	class c
	{
		c() { }
	};
}

namespace test_3
{
	class c
	{
		c() { }
	};
}

and this is what I am seeing in the Alt-M list, the namespace is being shown on each item, so I can tell which namespace each instance of the class belongs to. I do have my Alt-M list to shown the entries in order of Occurrence, but the namespaces are still quite clear:



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

Kram
Junior Member

Germany
13 Posts

Posted - Oct 11 2021 :  09:12:05 AM  Show Profile  Reply with Quote
Sorry, senior moment.

I had the Reduce the display of namespace scopes on! Must have been late when I read your message.

If I disable the the Reduce the display of namespace scopes option then I list is as your described.

B00ting, please wait...
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17503 Posts

Posted - Oct 11 2021 :  12:25:58 PM  Show Profile  Reply with Quote
Thank you for checking To be fair, it is easy to read that setting backwards, I have done so myself now and then. I am glad this is working as expected now. But also best to check, since things don't always work as we intend, as I am sure you know.

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

Kram
Junior Member

Germany
13 Posts

Posted - Oct 27 2021 :  2:50:27 PM  Show Profile  Reply with Quote
Hello,

I finally figured out a simple example to demonstrate the original issue that I posted.

With the example below the constructor shows up three times using Alt-M.

Remove the noexcept and it only shows up once.

The interesting thing is that the issue only presents when the code is in a header file. If the example is in a cpp file then it works correctly.

namespace test_3
{
    class c
    {
    public:
        c() noexcept : 
            m1(0), 
            m2(1), 
            m3(2)
        {
        }
    private:
        int m1, m2, m3;
    };
}

B00ting, please wait...

Edited by - Kram on Oct 27 2021 2:53:40 PM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17503 Posts

Posted - Oct 28 2021 :  08:51:26 AM  Show Profile  Reply with Quote
Interesting, that you for the clear example. This has actually come up once before, but when it did I was looking at the problem in the cpp file, where as you have found this works slightly differently. Still the same bug though:

case=146242

we do have a work around if you are interested in trying it though. You need to use a macro for the "noexcept" keyword, so your class would become something like:

#define VA_WORKAROUND_HIDE_NOEXCEPT noexcept
	
class c
{
public:
	c() VA_WORKAROUND_HIDE_NOEXCEPT :
		m1(0),
		m2(1),
		m3(2)
	{
	}
private:
	int m1, m2, m3;
};

this doesn't actually help on its own, but now you need to create a new text file called "va_stdafx.h" in the same directory as your SLN file. Edit this file and add the line:

#define VA_WORKAROUND_HIDE_NOEXCEPT

making sure that the file ends with a blank line.

When rebuilding its symbol database VA searches for this file, and if found, it parses it before parsing anything else. This file is used to give our parser helpful hints, and to work around odd problems that we encounter. The file should not be added to your solution, so it doesn't matter if the content of the file conflict with code inside your solution.

In this case the file is being used to "hide" the macro from VA, by telling VA that the macro simply does nothing.

Having created and edited the file, in the IDE press the button:

VA Options -> Performance -> Rebuild symbol databases

and restart your IDE. This is fixing the problem for me, testing inside a header file.

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:
© 2021 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000