There are times when I want to know *exactly* what is inside my source files. In my article on EHEP explains how to get down to the hex bytes of a source file. But in many cases I’m interested to see the non printable/white characters only. Showing white spaces in the sources is easy in Eclipse: I use the ‘Show Whitespace Characters‘ toolbar icon:
In case that icon is not present in the tool bar, here is how to show it in the toolbar. I use the menu Window > CustomizePerspective and enable it:
I happens to me when I integrating sources from somebody else, that it looks like this: a lot of bytes wasted with white spaces. Not that I’m worried by the disk space used (we have plenty of disk space these days), but these spaces are simply not needed.
Remove them by hand? Create a regular script expression to have them removed? Nope!
As in my post on Anyedit, there is a plugin which allows advanced editor manipulations, including removal of white spaces. But there is anther way for removing trailing white spaces. Eclipse has an option for that: I go to Window > Preferences > C/C++ > Editor > Save Actions:
Here I can select the option to Remove trailing whitespace. Additionally an option ensures that there is always a newline at the end of the file. And my source files are clean!
Warning: This ‘Save Action’ option does *not* work in Eclipse 3.6 version (which is in CodeWarrior for MCU10.2). But it *does* work in Eclipse 3.7 which is part of MCU10.3