Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Cannot change signature

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
naveensharma Posted - Jul 16 2014 : 05:03:47 AM
Hi,

When I try to change the signature of a function, I get error - "Missing argument name". I have attached the screen shots. Screen1 shows the original function signature. Screen2 shows what I am trying to change to and the error coming.











system and visual assist information:
License: [email protected] (1-user license) Support ends 2015.06.12
VA_X.dll file version 10.8.2036.0 built 2014.05.22
DevEnv.exe version 11.0.61030.0 Professional
msenv.dll version 11.0.61030.0
Comctl32.dll version 6.10.7601.17514
Windows 7 6.1 Build 7601 Service Pack 1
8 processors (x86-64, WOW64)
Language info: 1252, 0x409

Platform: Project defined
Stable Includes:
C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.1A\\include;
C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\VC\\atlmfc\\include;
C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\VC\\include;

Other Includes:

Stable Source Directories:
C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\VC\\crt\\src;
C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\VC\\atlmfc\\src\\atl;
C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\VC\\atlmfc\\src\\mfcm;
C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\VC\\atlmfc\\src\\mfc;

Language Used: C++

IDE Information:
Microsoft Visual Studio Professional 2012
Version 11.0.61030.00 Update 4
Microsoft .NET Framework
Version 4.5.50709

Installed Version: Professional

Team Explorer for Visual Studio 2012 04938-004-0033001-02517
Microsoft Team Explorer for Visual Studio 2012

Visual Basic 2012 04938-004-0033001-02517
Microsoft Visual Basic 2012

Visual C# 2012 04938-004-0033001-02517
Microsoft Visual C# 2012

Visual C++ 2012 04938-004-0033001-02517
Microsoft Visual C++ 2012

Visual F# 2012 04938-004-0033001-02517
Microsoft Visual F# 2012

Visual Studio 2012 Code Analysis Spell Checker 04938-004-0033001-02517
Microsoft� Visual Studio� 2012 Code Analysis Spell Checker

Portions of International CorrectSpell� spelling correction system � 1993 by Lernout & Hauspie Speech Products N.V. All rights reserved.

The American Heritage� Dictionary of the English Language, Third Edition Copyright � 1992 Houghton Mifflin Company. Electronic version licensed from Lernout & Hauspie Speech Products N.V. All rights reserved.

ASP.NET and Web Tools 2012.3.41009
Microsoft Web Developer Tools contains the following components:
Support for creating and opening ASP.NET web projects
Browser Link: A communication channel between Visual Studio and browsers
Editor extensions for HTML, CSS, and JavaScript
Page Inspector: Inspection tool for ASP.NET web projects
Scaffolding: A framework for building and running code generators
Server Explorer extensions for Windows Azure Web Sites
Web publishing: Extensions for publishing ASP.NET web projects to hosting providers, on-premises servers, or Windows Azure

NuGet Package Manager 2.8.50313.31
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

PreEmptive Analytics Visualizer 1.0
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Data Tools 11.1.20627.00
Microsoft SQL Server Data Tools

Visual Assist
For more information about Visual Assist, see the Whole Tomato Software website at http://www.WholeTomato.com. Copyright (c) 1997-2014 Whole Tomato Software, Inc.


Thank You.
19   L A T E S T    R E P L I E S    (Newest First)
naveensharma Posted - Jul 30 2014 : 12:33:16 AM
ok. That's a better option for me. Thank you so much for the idea feline.
feline Posted - Jul 29 2014 : 1:41:30 PM
Given you have commented out parameters in your declarations, the simplest solution is to use Alt-g to jump to the implementation, and to then trigger Change Signature from there. This will uncomment the parameter names in your declarations though.
naveensharma Posted - Jul 29 2014 : 04:40:33 AM
Then probably I used change signature with parameter names in functions and it has never worked.
All of my code in the headers have parameters commented and I am surprised why I never noticed it.

I understand it is possibly confusing for VA to handle it. Thank you anyway for looking at this issue in detail and trying to help!
feline Posted - Jul 29 2014 : 12:28:45 AM
Compiling the code and refactoring the code are quite different operations. To compile the code, the compiler is quite happy without any parameter / argument names on the declaration, so long as they exist on the implementation when you want to actually use them.

To look at what VA used to do I have just installed VA 1738, an older version, before the new validation was introduced, onto a VS2005 test system. I am using the following test code:

class testChangeSigMismatch
{
	int testNoNames(int, int);
};

int testChangeSigMismatch::testNoNames(int nFirst, int nSecond)
{
	return nFirst + nSecond;
}

I then trigger Change Signature on the declaration and add an "int" parameter at the end of the signature. This produces the code:

class testChangeSigMismatch
{
	void testNoNames(int, int, int);
};

void testChangeSigMismatch::testNoNames( int, int, int )
{
	return nFirst + nSecond;
}


VA has done exactly what I told it to do, it has updated the signature on both the declaration and the implementation to the new signature. Unfortunately the new signature does not have any parameter names, and the function implementation is now broken. This is the sort of situation the new validation checks were added to stop, since breaking your code is something we try very hard to avoid.
naveensharma Posted - Jul 26 2014 : 04:05:12 AM
Do not take my words as grain of salt. What I was pointing towards is parsing of C++ code.

I do not remember correctly but all my code is like this and I have used change signature in past as well. Which means, this may be working fine in older releases. We have upgraded our code from VS6 to VS2012 because of WinXP going out. This was the first time I used change signature on VS2012. Is it possible that it worked on VS6 ? I am not sure though.
feline Posted - Jul 25 2014 : 7:19:17 PM
Can Visual Studio do this? Which version of Visual Studio are you using? I am not even seeing a Change Signature refactoring command in Visual Studio 14 CTP 2, which has added some basic C++ refactoring commands.

Do I understand correctly that older versions of VA were "working", but you had to come along and fix the code after you ran Change Signature? Or was Change Signature actually fully working, even when the function declaration lacked parameter names?
naveensharma Posted - Jul 24 2014 : 11:34:50 PM
I don't know what to say, because I am not trying to solve this problem here. I am not trying to be a programmer here but a user of VA.

I just think if Visual Studio can do, why can't VA. Everything is possible. But if you think it is not, then I am good with whatever I have.


Thank you for looking at it.
feline Posted - Jul 24 2014 : 3:36:15 PM
BOP, your second problem, about the duplicate file names, how could we define a duplicate? Many people have more than one file with the same name in the same solution. I have talked to people who add the same file more than once to different projects inside the same solution, all with the same path. I have even seen people use linked files in source control to have multiple "linked and identical" copies of the same file in different directories, all of which are part of the same solution.

Without some idea of why the file got opened, where it came from, I am not sure what I can say here. Certainly simply warning you if you find two files with the same name won't work very well, just consider "stdafx.h".
feline Posted - Jul 24 2014 : 3:32:41 PM
Change Signature was changed, the validation was added, to try and make Change Signature more reliable, and to stop problems. Let us use naveensharma's example:

int Blah(int x, int /*y*/)
{
   x = 10;
}

now the comment can be ANYTHING, we do not get to assume this is a possible variable name, so the code is effectively:

int Blah(int x, int)
{
   x = 10;
}


BOP, if we just look at the changes, but there are no variable names, then how do we know what the change was? How do we tell re-ordering parameters from adding or removing parameters? What about changing the TYPE of a parameter but leaving everything else alone?

If we limit what Change Signature can do, then perhaps we could safely operate without parameter names, and know what we were doing, but that is going to remove functionality people are using and relying on.

If I understand correctly what you are saying is that VA used to break your code when you did a Change Signature, because the declarations and implementations were different, and you were fixing the code manually afterwards. Most people would simply rather that we don't break the code in the first place, which is why we added the validation to try and make sure we were not breaking things.
BOP Posted - Jul 23 2014 : 06:57:22 AM

(#2) >>If you accept the Change Signature dialog without any names, what should we do to the implementation? Removing the names from the implementation, which is what you have told us to do, will break your code.

Yes it does <shrug> as per previous post.
The VAX S/R logic appears to simply replace the entire signature strings at > declaration and implementation.

However, somewhat like the new edit parsing system, the following ~should~ give a correct signature for BOTH styles,
a named or not named declaration, just a bit more complicated:
(Using sub strings handling and taking care of whitespace). This changes the data type.. but not any names.
This handling of the declaration, ignoring any names, is the way the compiler does it.

(int << sig starts here
^ look at the first data type. You could chuck it "if not matching the original", but really no need to look at it, just replace with "double" here, as per the edited line.

!! ** skip to, and then over, the next "," ... do NOT CARE if there were some chars (eg a name) there or not.
,int << now.. we are after that first ","
^ look at the next data type here. If type == int, then leave it (or do the previous thing & just stuff it).

At this point according to the "edited line" we must enter a NEW "," so before doing that, **_skip over any chars here_ (eg there could be a name but skip it)
Put in the new "," then put in whatever data type is there in the "edited line".

Deal with the calling sites similar to the current method using TODO.

So now we have, when this routine is applied to the definition site:

Blah(double foo, int bar, CString &TODO)

...and when that same routine is applied to the _declaration_ site we will have the "desirable version", irrespective of if it has names there OR not. The result there is:

Blah(double, int, CString &TODO) .. OR else it will also include names ... if there were any names there already.

** == if you go with the system of replacing "names" then items marked this way above need some mods to do that.


=====================
== The duped file problem ==
This was one of those nasties which took a day or more to even wake up to what the problem was.

If you have 8 tabs up, and you _concentrate_ on editing/compiling just one file, and it randomly gives
crazy results, it is hard to notice that one of the tabs is actrually a duplicate of what you are editing, and which has appeared all by itself : (
And the debugger, IDE, compiler are using random combos of these instances.

The way VAX could help would be to popup:

=====================
Hey! you have [2] instances of:
Blah.cpp

in use
====================
This is just one of those things that wasted a lot of productivity time, but it seems probably not worthwhile to institute at this distance. Put it in suggestions box?
As you mentioned this behaviour is actually legal.
BOP Posted - Jul 23 2014 : 06:52:18 AM
Ah simple, thanks.

Result of the great divide of putting stuff in the declaration, or not.
Having clean declarations is a style choice, but have always considered that it is really a C++ language *feature*.

VAX was reasonably OK with either version, until this change.

VAX appears to simply make a straight string replacement in both instances.
[Change Signature] would mess my definition line, but was not really a problem.

I developed the habit of:
Before making any change, make a copy of the definition line so you can see what was there if things go wrong, or if you just change your mind.

When the signature got cleaned out by change signature, just paste the appropriate existing names which are in that copy, back to the arguments, and then go and name any new stuff.

No big deal because you must also look at the body, and the calling sites anyway, to check for any resulting problems there.

Worked well and used it continuously without second thought, but now I will have to get used to the evil style.

I can of course use names in the "new style" signature and then go and remove the names from the declaration : (

Have 68 .h and .cpp with the old style in the project.

Doxygen appears to require the named style... but their docs seem to not use it at some places in their examples.

To avoid bloat here, I will make another post (#2) with my suggestion.
naveensharma Posted - Jul 22 2014 : 01:52:54 AM
I installed the latest build of VA - VA_X.dll file version 10.8.2043.0 built 2014.07.10.

What is happening now is, the refactoring menu gets disabled. I got you feline when you said that if the parameters are commented, VA gets confused. To workaround the problem, the parameters needs to be uncommented and it works fine.

What I want to say is, we see this kind of code frequently where parameters in declaration are commented out. In fact all my code is like this.

Another example could be, lets say I have this function:

int Blah(int x, int y)
{
   x = 10;
}


In this case the compiler would give a warning that 'y' is not used. Why 'Y' is not being used will take us to a different discussion. To avoid this warning, what I am going to do is this -

int Blah(int x, int /*y*/)
{
   x = 10;
}


All this being valid code and I think VA should handle it.
This problem was not before, I do not remember which version of VA but earlier I have always used change signature perfectly.


Thanks.
feline Posted - Jul 18 2014 : 2:01:03 PM
Change Signature, when you return the function to the original signature, you are not asking VA to do anything, so no error message will be shown. Note the OK button is disabled.

To fix this, simply give the function parameter names / argument names. So change:

int Blah(int,int);

into:

int Blah(int foo,int bar);

I know you don't need to provide parameter names for the declaration, but when you have the declaration with no parameter names, and an implementation with names, it gets harder for VA to know it is doing the right thing when it updates your code. If you accept the Change Signature dialog without any names, what should we do to the implementation? Removing the names from the implementation, which is what you have told us to do, will break your code.

Pure virtual functions are a special case, since they hardly ever have implementations.


For the duplicate file problem, I am not sure what happened here. This can happen if you have two versions of the solution, the current version and an older version, and you then open a file from the older solution in the current IDE instance. VA parses files when you open them, so this will tell VA about the old version of the solution.

Has this happened often, or was it a one off problem?
BOP Posted - Jul 17 2014 : 7:53:28 PM
Hello
Thanks for looking at the problem. NB: you are replying to the OP and me in your post so confused me a bit.

My (long to describe) problem is:

I go to the declaration in the header (or anywhere else):

int Blah(int,|int);//!! the "|" is just for simulating my cursor here, pointing to what I am about to edit.

in order to change it to:
int Blah(int);

As soon as I take off the that "i" I get "Error:Missing argument name" as per the OP.
This might be fair... but then when I finish and make it:

int Blah(int);

or ANY other signature including the "return" signature, except that (the argument signature) works OK with (void) or ()
I am left with >> "Error:Missing argument name" and the OK button grayed out.

If I edit it back to the original signature then it is OK with that.
I have tried this with other people's code... same thing.

All other VAX functions work correctly AFAIK. (especially the similar "change name" does).
I do have a screen shot but it just similar to the OPs.

////
That dupe .cpp problem was:
I have several tabs open with various files.
I edit Blah.cpp. Compile, run a few times.... eventually mysteriously fails..
Then I notice that another apparently older (from the old installation?) Blah.cpp has appeared on a tab!
And I am editing and compiling random stuff :(

Not likely to be a VAX artefact, (I might have fixed this by changing environment paths.. can't remember).

Only mentioned because: Is VAX still looking at some file in that old installation because of some incorrect path still there?

== This info is from about a month ago. ==
==================================================
VA_X.dll file version 10.8.2036.0 built 2014.05.22
DevEnv.exe version 12.0.21005.1 Ultimate
msenv.dll version 12.0.21005.1
Comctl32.dll version 6.10.9600.17031
Windows 8.1 6.3 Build 9600
4 processors (x86)
Language info: 1252, 0xc09

Regards

Rob
feline Posted - Jul 17 2014 : 2:56:42 PM
Are you aware you can just uncomment the parameter names in your function signature, and then Change Signature will run perfectly happily?

Running change signature manually only makes sense for rarely used functions, if you need to avoid uncommenting the parameter names.

What is happening here is that we added some validation to Change Signature, to make sure that the changes you were making were reasonable. This was designed to catch simple mistakes before we updated the code, since those mistakes could break all of the function calls. As you are seeing though, it is possible to run into the validation checks when you don't expect them. You will have been using an older version of VA, before the validation checks were added, which is why this suddenly started to happen to you.

For other problems you are having, I am going to need some more details before I can comment sensibly on them. When you say "pulling up the came .cpp file twice in the IDE" what do you mean? You can tell the IDE to open the same file twice, in two separate tabs, but VA should never do this its self.
BOP Posted - Jul 17 2014 : 01:44:53 AM
Glad you raised it. Thought it was just "me", seeing that it has never been mentioned so far.
I give this advice to the "fixers" but not wanting to lead them astray... probably wrong :(

This happened many months ago when I upgraded from VS2010 to VS2013, and purchased a new VAX at the same time.
VAX had always worked in the past, but this function has never worked since that upgrade.

After upgrading, VS2013 was a bit erratic... eg putting up the same .cpp twice in the IDE etc.
There appeared to be some tieup between the old 2010 installation and the IDE upgrade.. which cured itself eventually.

I have wondered if VAX is looking at the OLD installation for some things?
But I cannot see that any file has been updated in the old installation though,
and that previous installation just does not want to fire up now to check it.
naveensharma Posted - Jul 17 2014 : 12:06:54 AM
Thank you feline for looking at it.

yes, you are right BOP, for a larger project it's tough to do it manually. But for now, I have only this option available.

BOP Posted - Jul 16 2014 : 11:16:55 PM
I have had the same problem ever since upgrading VAX a long time ago (and to VS2013).
It does allow you change from (void) to () or vice versa though.

Also the "return" signature can do a similar thing.
I need this function, it is my favourite ... one of the few I actually use.
Manually updating a large project is a real pain.
Gives the impression it is missing a file somewhere with the allowed values.
feline Posted - Jul 16 2014 : 2:45:37 PM
I am seeing the same effect here. Thank you for the clear description.

case=83775

This is a surprise, hopefully you don't have to much code like this. For now you many need to just use Find References on the functions and manually update the signatures.

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