Compare different sections of the same file
Posted: Mon Jan 11, 2010 3:18 am
I would appreciate being able to compare a section of a file to another section of the same file.
I often write routines that look near identical to each other except for a few differences. The routines are in the same file and I need to compare them.
Currently, what I have to do is create a temporary file, copy one of the sections to it, then compare that file with the original.
E.g. File has these two routines:
CTxInstruct::CTxInstruct(const CTxInstruct& other)
{
memcpy((char*)this, (char *)&other, sizeof(CTxInstruct));
}
const CTxInstruct& CTxInstruct::operator=(const CTxInstruct& other)
{
memcpy((char*)this, (char *)&other, sizeof(CTxInstruct));
return *this;
}
I would be great if I could see the comparison of those two routines just as if each were in its own file.
Thanks!
I often write routines that look near identical to each other except for a few differences. The routines are in the same file and I need to compare them.
Currently, what I have to do is create a temporary file, copy one of the sections to it, then compare that file with the original.
E.g. File has these two routines:
CTxInstruct::CTxInstruct(const CTxInstruct& other)
{
memcpy((char*)this, (char *)&other, sizeof(CTxInstruct));
}
const CTxInstruct& CTxInstruct::operator=(const CTxInstruct& other)
{
memcpy((char*)this, (char *)&other, sizeof(CTxInstruct));
return *this;
}
I would be great if I could see the comparison of those two routines just as if each were in its own file.
Thanks!