user102008
user102008

Reputation: 31303

How can I diff two files, but ignore differences in Perl/C/C++ comments?

I would like to take the diff of two source code files, but I don't want it to report any differences for lines that only contain a programming language comment. The types of comments I would like it to ignore are:

// ...
# ...
/* ... */

Upvotes: 4

Views: 713

Answers (2)

Ira Baxter
Ira Baxter

Reputation: 95324

See our Smart Differencer for tools that compare programming langauge files according to structure, not lines of text. So, whitespace (including linebreaks if they are whitespace in your language) including comments gets ignored.

These tools work by parsing the source code to determine its structure.

There are SmartDifferencers for C and C++. Not one for Perl. Perl's hard to parse :-}

Upvotes: 0

Joel
Joel

Reputation: 5674

BeyondCompare has an option to ignore these comments.

Upvotes: 5

Related Questions