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
 1530 'Rename' and goto
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

kurt
Junior Member

15 Posts

Posted - Jul 27 2006 :  8:59:58 PM  Show Profile  Reply with Quote
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
17026 Posts

Posted - Jul 29 2006 :  12:41:44 PM  Show Profile  Reply with Quote
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
Go to Top of Page

bugfix
Tomato Guru

Germany
324 Posts

Posted - Jul 30 2006 :  12:44:57 AM  Show Profile  Reply with Quote
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
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17026 Posts

Posted - Jul 30 2006 :  1:35:28 PM  Show Profile  Reply with Quote
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
Go to Top of Page

kurt
Junior Member

15 Posts

Posted - Jul 31 2006 :  02:36:02 AM  Show Profile  Reply with Quote
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!
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17026 Posts

Posted - Jul 31 2006 :  5:41:09 PM  Show Profile  Reply with Quote
*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
Go to Top of Page

kurt
Junior Member

15 Posts

Posted - Aug 01 2006 :  7:31:30 PM  Show Profile  Reply with Quote
sure, no problem.
Go to Top of Page

mar10us
New Member

5 Posts

Posted - Oct 23 2008 :  10:33:48 AM  Show Profile  Reply with Quote
Any progress for this case?
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17026 Posts

Posted - Oct 23 2008 :  1:22:18 PM  Show Profile  Reply with Quote
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
Go to Top of Page

support
Whole Tomato Software

5566 Posts

Posted - Oct 29 2012 :  11:14:04 AM  Show Profile  Reply with Quote
case=1909 is fixed in build 1918
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2019 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000