Code clean up

Can anybody suggest a shareware C++ code beautifiers (indents and what not) for the PC?

Thanks!

dave
esdaveAsked:
Who is Participating?
 
Anju111599Connect With a Mentor Commented:
You'll find it here:

ftp://ftp.gnu.org/gnu/indent/

Anju
0
 
Jan LouwerensSoftware EngineerCommented:
I don't know what you use now, but I know MS VC++ has code formatting. (At least v5.0.. haven't used 6.0 yet)
0
 
dspectorCommented:
It is true that Visual C++ has formatting (automatic indentation): you select the lines and issue the (poorly-named) command 'SelectionFormat'. It handles most, but not all, situations correctly, but is poorly parameterized (you can set the number of characters to indent and whether braces are at the same level as or indented from the previous statement).

However, this question is probably written by someone who doesn't have MSVC and doesn't want to spend $100 (more or less) to get it just to use it as a formatter.

I've previously looked and not found such shareware, which surprised me. I started to write my own, but it is one of many projects that I haven't had time to complete.
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
Jan LouwerensSoftware EngineerCommented:
and I also know Rational Rose had a code formatter for many languages, but once again, it's certainly not shareware, and probably more expensive then MSVC++
0
 
esdaveAuthor Commented:
Anju,

When I said PC I guess I should have said Windows based. I tried the ftp link you suggested and I'm thinking that this is for Unix/Linux and not Windows based. Am I correct?

Thanks!

Dave P
0
 
esdaveAuthor Commented:
Anju,

When I said PC I guess I should have said Windows based. I tried the ftp link you suggested and I'm thinking that this is for Unix/Linux and not Windows based. Am I correct?

Thanks!

Dave P
0
 
Anju111599Commented:
Dave,

It's a cross-platform application.  It works on UNIX *and* PCs.  It's a console application, so it isn't windows native, but I have compiled and run it in a Windows DOS box.  In fact, the source code is included and I've hacked the source to produce indentation which conforms to my own perverse coding style ;)

If you want a truly Windows native application, check out CodeWright from Premia: www.premia.com
It's the hands-down best Windows programmers editor and development environment available.  Among many other things, it does re-indentation and the indent style is configurable to your taste.  If you check around on their web site, I believe you'll find a very early version of the gnu indent which evolved over the years into what they're using in CodeWright.

Anju
0
 
jasonclarkeCommented:
emacs/xemacs has a good and easily configurable code formatting utility.  It may be a bit of a big download if this is all you want it for, however.

you can download xemacs (including the Win32 xemacs binary kit) from www.xenacs.org.
0
 
jasonclarkeCommented:
sorry, the link should have been www.xemacs.org
0
 
proskigCommented:
Hi,
check a link
http://www.codeproject.com/macro/MakeCodeNicer.asp
This is a macro for Visual C++.

Regards,
Igor
0
 
esdaveAuthor Commented:
Igor,

That look interesting. Can you tell me how to "plug-in" a macro? I downloaded the .dsm file. Do I just put it in the right location and magically I have a macro?

Thanks!

Dave P
0
 
proskigCommented:
Hi,
You are right. You put dsm file in a right place (c:\Program Files\Microsoft Visual Studio\Common\MSDev98\Macros\ on my machine). Then go to Tools->Customize->Add Ins and Macros, select this file as active. Close and reopen this dialog go to tab Keyboard, choose macro and assign Alt+F8 to a new macro called MakeCodeNicer.

Regards,
Igor
0
All Courses

From novice to tech pro — start learning today.