Author Topic: Automatic indent and cleanup for C / C++ source code?  (Read 12897 times)

0 Members and 1 Guest are viewing this topic.

Offline st1Topic starter

  • Contributor
  • Posts: 18
Automatic indent and cleanup for C / C++ source code?
« on: May 16, 2011, 11:04:41 am »
Hi, I was wondering if anyone knew of a program for Windows that can fix indentations and cleanup C / C++ source code?  ???

I've seen http://www.codeblocks.org/ do it. But i need windows side :O any ideas ?
I', using micro C and MPLAB but i cant see any options like that in it. :)

(I'm currently doing a work around by using codeblocks (windows version) and going back and forth when things need fixing, but it's kind of a pain  :P )
« Last Edit: May 16, 2011, 11:08:13 am by st1 »
 

Offline scrat

  • Frequent Contributor
  • **
  • Posts: 608
  • Country: it
Re: Automatic indent and cleanup for C / C++ source code?
« Reply #1 on: May 16, 2011, 12:35:55 pm »
I just made a test using Visual Studio Express (which is free, but is a huge package to install, IIRC), and it is able to auto intent the selected text (Edit->Advanced->Format selection). However, I never used that feature, so I don't know how good it works.

If you're already using Matlab for something else, its editor has a "Text->smart indent" command, too. I use this feature for M-files, it works perfectly, and seems to work for C-files, too.

Other free editors I use/used (dev-cpp, Notepad++) don't have automatic recognition and indentation features, AFAIK.
One machine can do the work of fifty ordinary men. No machine can do the work of one extraordinary man. - Elbert Hubbard
 

Offline firewalker

  • Super Contributor
  • ***
  • Posts: 2452
  • Country: gr
Become a realist, stay a dreamer.

 

Offline dengorius

  • Regular Contributor
  • *
  • Posts: 96
Re: Automatic indent and cleanup for C / C++ source code?
« Reply #3 on: May 16, 2011, 02:05:44 pm »
Indent.

It also runs under windows http://gnuwin32.sourceforge.net/packages/indent.htm
 

Offline senso

  • Frequent Contributor
  • **
  • Posts: 951
  • Country: pt
    • My AVR tutorials
Re: Automatic indent and cleanup for C / C++ source code?
« Reply #4 on: May 20, 2011, 02:54:34 am »
I use GVim a lot, can use it in Windows and Linux, and to auto-indent all my code I do this:
ESC to go to command mode and then
gg=G and it auto-indents all the file, its also a nice and very very powerfull editor, with more capabilities than a lot of clicodrome IDE's
 

Offline A-sic Enginerd

  • Regular Contributor
  • *
  • Posts: 144
Re: Automatic indent and cleanup for C / C++ source code?
« Reply #5 on: June 08, 2011, 05:26:12 pm »
For work - verilog and system verilog it's all in gvim.

However, for C code (as well as many other software languages) it's hard to beat SlickEdit. Has configurable beautifier. You can configure your preference of coding style and it just simply does it. Costs a few bucks, but it's trick enough that I know a number of people (including myself) that sprung for a copy even for personal use. It's capable of serving as your complete IDE as well.
The more you learn, the more you realize just how little you really know.

- college buddy and long time friend KernerD (aka: Dr. Pinhead)
 

Offline Phyllostachys

  • Newbie
  • Posts: 1
Re: Automatic indent and cleanup for C / C++ source code?
« Reply #6 on: June 23, 2011, 01:15:12 pm »
In Visual Studios with the focus on the code window, type in the key sequence: ctrl-A, ctrl-k, ctrl-F. This will highlight then do proper formatting of all code in the window.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf