Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 List Methods shows Constructor multiple times

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
Kram Posted - Oct 08 2021 : 11:04:09 AM
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;
    };
}


9   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Oct 28 2021 : 08:51:26 AM
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.
Kram Posted - Oct 27 2021 : 2:50:27 PM
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;
    };
}
feline Posted - Oct 11 2021 : 12:25:58 PM
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.
Kram Posted - Oct 11 2021 : 09:12:05 AM
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.
feline Posted - Oct 11 2021 : 08:59:22 AM
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:


Kram Posted - Oct 08 2021 : 1:35:41 PM
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.
feline Posted - Oct 08 2021 : 1:02:10 PM
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.
Kram Posted - Oct 08 2021 : 12:51:40 PM
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.
feline Posted - Oct 08 2021 : 11:33:24 AM
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.

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000