4

I need to compare two files as .txt or .c or anything. These files have the same class name and same functions. But the functions are not in the same order for two classes.

The first file is:

class A
{

int subtract (int a, int b){
//some code here
int c=a;
int d=b
return c-d;
}


int add (int a, int b){
//some code here
return a+b;
}

}

Second file is:

class A
{


int add (int a, int b){
//some code here
return a+b;
}



int subtract (int a, int b){
//some code here
return a-b;
}

}

Using notepad++ compare tool or ultracompare tool do not give what I want. They say that

subtract is changed to add in line 4
int c=a;
int d=b
return c-d; removed
return a+b; added

And much more nonse because they compare line by line, I want some intelligence.

But I want that

int add (int a, int b){
//some code here
return a+b;
} is moved to 15. line 

and in

int subtract (int a, int b){
//some code here
return a-b;
}

function

int c=a;
int d=b
return c-d; removed
return a-b; added

Is there any compare tool that does what I want, especially free or cheap?

  • I am not sure but did you try Beyond Compare ? – Marged Feb 23 '16 at 17:39
  • Beyond Compare doesn't detect moved sections, it will show them differences (inserted/deleted lines). To force two moved sections to compare, right click on a line on the left and select Align With, then left click on a line on the right. – Chris Kennedy Feb 24 '16 at 16:11
  • Not posting this as an answer because it's not free and I've never used it, but semanticmerge.com seems to have a product with a 15 day free trial. – CPerkins Feb 24 '16 at 18:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.