Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Problems with extract method

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
bjoern.jonsson Posted - Oct 04 2006 : 08:48:09 AM
Hi all,
I've just installed the trial version of VA X because i'm planning to do a major refactoring on some quite old code. Much of this refactoring will deal extracting parts of (very, very, very) long functions into shorter ones.

But somehow i just don't manage to get VA X to use references where it would clearly be needed. It even fails on:

int CMeasureObject::DummyDoNothing()
{
	int a=1, b=2, c=3;
	float f=0.0,g=1.0,h=1.0;

	for(a=b;a<=c;a+=b)
	{
		f=a*c+b;
		g=f*h;
		h=f*g;
	}
	return (int)f*g*h/3;
}

select the lines inside the for loop -> extract function and what i get is:

int CMeasureObject::DummyDoNothing()
{
	int a=1, b=2, c=3;
	float f=0.0,g=1.0,h=1.0;

	for(a=b;a<=c;a+=b)
	{
		MyMethod(f, a, c, b, g, h);
	}
	return (int)f*g*h/3;
}

void CMeasureObject::MyMethod( float f, int a, int c, int b, float g, float h )
{
	f=a*c+b;
	g=f*h;
	h=f*g;
}

btw: i'm on build 1535

Thanx

BJ
4   L A T E S T    R E P L I E S    (Newest First)
sean Posted - Dec 19 2006 : 9:15:48 PM
case=2866 is fixed in build 1543
feline Posted - Oct 05 2006 : 11:08:54 AM
i am seeing the same problems here. for me the effect seems to be slightly more subtle. using the detailed example in your second post changing the line:

g = f*h;

to

g=f*h;

causes problems.

case=2866

thank you for your detective work on this.
bjoern.jonsson Posted - Oct 05 2006 : 03:53:58 AM
There is even more to it:

seems like ExtractMethod fails to notice assignements of type:

a=anything; //space before or after = will make VAX notice assignement
a<<=2;
a <<= 2;
a/=2; //funny, *= works...
a|=2; //&= works...

which is rather annoying.

can anyone reproduce this, or is it just me?
bjoern.jonsson Posted - Oct 04 2006 : 08:59:09 AM
Found it:

int CMeasureObject::DummyDoNothing()
{
	int a=1, b=2, c=3;
	float f=0.0,g=1.0,h=1.0;

	for(a=b;a<=c;a+=b)
	{
	      f=a*c+b;
	      g = f*h;
	      h = f*g;
	}
	return (int)f*g*h/3;
}

gets to:

int CMeasureObject::DummyDoNothing()
{
	int a=1, b=2, c=3;
	float f=0.0,g=1.0,h=1.0;

	for(a=b;a<=c;a+=b)
	{
		MyMethod(f, a, c, b, g, h);

	}
	return (int)f*g*h/3;
}

void CMeasureObject::MyMethod( float f, int a, int c, int b, float &g, float &h )
{
	f=a*c+b;
	g = f*h;
	h = f*g;
}


so it seems like assignements without space before or after the = are ignored.

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