Author |
Topic  |
|
kurt
Junior Member
 
15 Posts |
Posted - Jul 27 2006 : 8:59:58 PM
|
Trying to rename the goto label 'err' via the refactor menu.
if (p)
goto err; /*1*/
if (q)
goto err; /*2*/
err: /*3*/
If the mouse was on the occurrence of 'err' at /*1*/ or /*2*/, then both of those occurrences change to the new name; /*3*/ should change but does not.
If the mouse was on the occurrence of 'err' at /*3*/, then only /*3*/ changes; /*1*/ and /*2*/ should change but do not.
(VS2005 C++) |
|
feline
Whole Tomato Software
    
United Kingdom
19177 Posts |
Posted - Jul 29 2006 : 12:41:44 PM
|
might one suggest not using goto?
pasting this code sample into VS2005, using VA 1530, rename on any of the three instances of "err" lists all three instances in the rename window. do you see the error with this actual sample?
if you are using "err" in different context's then VA may well not be searching far enough across the file, thinking that err is a local variable instead of a label name. |
zen is the art of being at one with the two'ness |
 |
|
bugfix
Tomato Guru
    
Germany
324 Posts |
Posted - Jul 30 2006 : 12:44:57 AM
|
feline, there are definitely situations where gotos make sense and code even more readable. Speaking of labels, did someone try refactoring on inline asm?:)
|
http://www.mf-sd.de |
 |
|
feline
Whole Tomato Software
    
United Kingdom
19177 Posts |
Posted - Jul 30 2006 : 1:35:28 PM
|
i really like to avoid goto's in my code, and i normally manage still i agree there are times when you need something like this.
as for inline asm, i don't recall that on the feature matrix, so i shall claim it is not officially supported  |
zen is the art of being at one with the two'ness |
 |
|
kurt
Junior Member
 
15 Posts |
Posted - Jul 31 2006 : 02:36:02 AM
|
Ok, here's a complete example. The problem occurs with a goto out of a switch.
int f(int i)
{
int j;
switch (i)
{
case 1:
j = 88;
goto zyxxy;
case 2:
j = 99;
break;
case 3:
j = 77;
goto zyxxy;
default:
return 0;
}
return j;
zyxxy:
return i*j;
}
Your advice on coding style is well taken. Perhaps you can help me polish up this million or so lines of legacy code? Thanks! |
 |
|
feline
Whole Tomato Software
    
United Kingdom
19177 Posts |
Posted - Jul 31 2006 : 5:41:09 PM
|
*ouch* there is a lot of difference between inheriting a lot of goto's in code, and adding new ones. you have my sympathies if your code base is like this example! i made the foolish assumption that you would not have inherited many, since most people try to avoid them.
i am seeing the same problem with rename as you. at a guess VA thinks it has two different local variables, at different scope's, and is reacting accordingly.
case=1909
for now, can you use the IDE's find and replace to rename the labels? |
zen is the art of being at one with the two'ness |
 |
|
kurt
Junior Member
 
15 Posts |
Posted - Aug 01 2006 : 7:31:30 PM
|
sure, no problem. |
 |
|
mar10us
New Member

5 Posts |
Posted - Oct 23 2008 : 10:33:48 AM
|
Any progress for this case? |
 |
|
feline
Whole Tomato Software
    
United Kingdom
19177 Posts |
Posted - Oct 23 2008 : 1:22:18 PM
|
Unfortunately no progress yet, but I have just increased the priority on this bug for you. Hopefully this will help a bit. |
zen is the art of being at one with the two'ness |
 |
|
support
Whole Tomato Software
    
5566 Posts |
Posted - Oct 29 2012 : 11:14:04 AM
|
case=1909 is fixed in build 1918 |
 |
|
|
Topic  |
|