Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

White Space or Not, That's the Question

DZone's Guide to

White Space or Not, That's the Question

· Performance Zone
Free Resource

Discover 50 of the latest mobile performance statistics with the Ultimate Guide to Digital Experience Monitoring, brought to you in partnership with Catchpoint.

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:

Show Whitespace Characters

Show Whitespace Characters

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:

Enabling Show Whitespace for Toolbar

Enabling Show Whitespace for Toolbar

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.

Trailing White Spaces in Source File

Trailing White Spaces in Source File

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:

Save Action to remove trailing white spaces

Save Action to remove trailing white spaces

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 :-)

Happy Spacing :-)

Is your APM strategy broken? This ebook explores the latest in Gartner research to help you learn how to close the end-user experience gap in APM, brought to you in partnership with Catchpoint.

Topics:

Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}