Q: How to diff cpp files only of 2 directories? I am trying to execute diff something like:
diff -aru ifm/*.cpp ../ifm/*.cpp 2>&1 | tee ifm.diff

It gives me error: 
diff: extra operand `ifm/ifmArchiveFileReaderWriter.cpp'
diff: Try `diff --help' for more information.

Am i missing something?

A: The problem you are running into with the collection of files you are trying to present diff with is exactly why diff has the ability to scan 2 directories and diff common files between the two. It has its own index that keeps track of what files in list a correspond to files in list b. You can't just give diff two seemingly unrelated lists of files and expect that it has some sneaky way of discerning that file1.txt in list 1 corresponds to file1.txt in list 2 when they are shuffled between 50 other files. diff either compares files or directories.
That doesn't prevent you from organizing many files through arrays or tmp files, and then iterating over the list passing diff 2 files at a time that are proper. You just can't throw all of them at diff at once and expect diff to do it.
This is where good directory planning can really help insure that you can make use of diff in the way you would like. With two directories you can logically compare, then a good unified diff is a simple way to visualize the differences and at the same time provide patch information to others who can make use of your improvements to the code. A good diff -uNrw dir dir2 > dir_dir2.diff is a great way to handle it. Gook luck.
