I know about the "Format on save" option in Java editor, but I could not find one in C/C++ ... Or maybe I haven't looked enough?
I'm afraid that option is simply not available for the CDT C++ editor (Eclipse CDT Juno Service Release 1):
That's everything that's available at Eclipses IDE Level.
There are two solutions you might consider to solve your concerns:
- You might consider adopting some discipline as mentioned in the other answers
- Running an appropriate script to format your source files before committing them. The AStyle tool might be helpful for this purpose.
One could also think about an automatic pre-checkin/-commit interception running a script for the actually used Revision Control System. Many revision/version control systems offer such feature.
May I expect to see such option one day?
Did you ask for this feature on the Eclipse/CDT community forum, or placed a feature request in the Eclipse CDT bugzilla tracking system? If no one knows about such feature demand and whether it is demanded by a majority of users, chances that this will be implemented by 'accident' are low.