Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automatically reformatting code?

Status
Not open for further replies.

cpjust

Programmer
Sep 23, 2003
2,132
US
Hi,
I know eclipse can do this, but I'm not sure if Visual C++ 2005 can do it?

I have a bunch of old .c files that use that ugly type of formatting:
Code:
if (a==b) {
   if (c==d) {
      blah();
   }
}
which I want to convert to this more readable format:
Code:
if ( a == b )
{
   if ( c == d )
   {
      blah();
   }
}
Can I do this with VC++ 2005 or do I need to use some other tool?
 
On VC++, you can reindent the code but it won't rearrange the brackets for you. If it did, it would annoy most people.

There is a public domain pretty printer on Linux called indent but I don't know if there is a windows equivalent of it.
 
I used to code like that as you could see more code on a 25 line terminal. Nowadays, you can see more than 40 lines in one go so I don't mind either way.

 
GNU indent is also available via the cygwin port.


--
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top